summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorckonstanski <ckonstanski@pippiandcarlos.com>2020-01-16 17:21:23 +0000
committerckonstanski <ckonstanski@pippiandcarlos.com>2020-01-16 17:21:23 +0000
commitb1f9d41bf26ba68e1c559467caeb1935dab0d1bb (patch)
treed905c4b83776dda3008db922fbf60bd12a739c5e
parent656ee56e637d5b7c2e09124069b1ceaffbf6911e (diff)
Improve local builds and support docker-registry with no creds
-rwxr-xr-xbootstrap/run_salt.sh2
-rw-r--r--salt/gentoo_baseimage/ci/files/build.sh13
-rw-r--r--salt/gentoo_baseimage/gentoo_baseimage/files/build.sh4
-rw-r--r--salt/gentoo_baseimage/gentoo_baseimage/files/make.conf1
4 files changed, 10 insertions, 10 deletions
diff --git a/bootstrap/run_salt.sh b/bootstrap/run_salt.sh
index 47a9a4f..59fd402 100755
--- a/bootstrap/run_salt.sh
+++ b/bootstrap/run_salt.sh
@@ -3,7 +3,7 @@
working_dir="${1}"
build_basedir="${2}"
local_build="${3}"
-python=$(which python2 || false)
+python=$(which python3 || false)
salt_running_p() {
ps -ef | grep -F "salt-call" | grep -v "grep"
diff --git a/salt/gentoo_baseimage/ci/files/build.sh b/salt/gentoo_baseimage/ci/files/build.sh
index b42f01b..547d0d2 100644
--- a/salt/gentoo_baseimage/ci/files/build.sh
+++ b/salt/gentoo_baseimage/ci/files/build.sh
@@ -1,21 +1,22 @@
#!/bin/bash -e
+basic_auth='{% if pillar["registry"]["username"] != None %}-u \'{{ pillar["registry"]["username"] }}:{{ pillar["registry"]["password"] }}\'{% endif %}'
+
mark_for_gc() {
image_name="${1}"
- for tag in $(curl -u '{{ pillar["registry"]["username"] }}:{{ pillar["registry"]["password"] }}' -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' https://{{ pillar["registry"]["url"] }}/v2/${image_name}/tags/list | jq '.tags' | grep -o -P '[a-fA-F0-9]+'); do
- digest=$(curl -u '{{ pillar["registry"]["username"] }}:{{ pillar["registry"]["password"] }}' -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' https://{{ pillar["registry"]["url"] }}/v2/${image_name}/manifests/${tag} | jq '.config.digest' | awk -F\" '{print $2}')
+ for tag in $(curl -k ${basic_auth} -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' https://{{ pillar["registry"]["url"] }}/v2/${image_name}/tags/list | jq '.tags' | grep -o -P '[a-fA-F0-9]+'); do
+ digest=$(curl -k ${basic_auth} -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' https://{{ pillar["registry"]["url"] }}/v2/${image_name}/manifests/${tag} | jq '.config.digest' | awk -F\" '{print $2}')
if [ "${digest}" != "" ]; then
- curl -u '{{ pillar["registry"]["username"] }}:{{ pillar["registry"]["password"] }}' -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' -X DELETE https://{{ pillar["registry"]["url"] }}/v2/${image_name}/manifests/${digest}
+ curl -k ${basic_auth} -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' -X DELETE https://{{ pillar["registry"]["url"] }}/v2/${image_name}/manifests/${digest}
fi
done
}
-{% if pillar["ci"]["local_build"] != True %}
+{% if pillar["ci"]["local_build"] == False %}
+{% if pillar["registry"]["username"] != None %}
echo "Login to docker registry"
echo '{{ pillar["registry"]["password"] }}' | docker login --username {{ pillar["registry"]["username"] }} --password-stdin {{ pillar["registry"]["url"] }}
{% endif %}
-
-{% if pillar["ci"]["local_build"] != True %}
mark_for_gc "{{ pillar["gentoo_baseimage"]["image_name"] }}"
{% endif %}
{{ pillar["gentoo_baseimage"]["build_dir"] }}/build.sh
diff --git a/salt/gentoo_baseimage/gentoo_baseimage/files/build.sh b/salt/gentoo_baseimage/gentoo_baseimage/files/build.sh
index beffb0c..151f9f8 100644
--- a/salt/gentoo_baseimage/gentoo_baseimage/files/build.sh
+++ b/salt/gentoo_baseimage/gentoo_baseimage/files/build.sh
@@ -25,14 +25,14 @@ echo "Deleting existing docker images"
for image in $(docker images | grep -F '{{ pillar["gentoo_baseimage"]["image_name"] }}' | awk '{print $3}'); do
docker rmi --force ${image}
done
-for image in $(docker images | grep -F 'gentoo' | awk '{print $3}'); do
+for image in $(docker images | grep -F 'stage3-amd64' | awk '{print $3}'); do
docker rmi --force ${image}
done
echo "Building docker image"
docker build -t {{ pillar["gentoo_baseimage"]["image_name"] }}:{{ pillar["ci"]["tag"] }} .
-{% if pillar["ci"]["local_build"] != True %}
+{% if pillar["ci"]["local_build"] == False %}
echo "Push docker image to the registry"
docker tag {{ pillar["gentoo_baseimage"]["image_name"] }}:{{ pillar["ci"]["tag"] }} {{ pillar["registry"]["url"] }}/{{ pillar["gentoo_baseimage"]["image_name"] }}:{{ pillar["ci"]["tag"] }}
docker push {{ pillar["registry"]["url"] }}/{{ pillar["gentoo_baseimage"]["image_name"] }}:{{ pillar["ci"]["tag"] }}
diff --git a/salt/gentoo_baseimage/gentoo_baseimage/files/make.conf b/salt/gentoo_baseimage/gentoo_baseimage/files/make.conf
index 96668a4..15ae1c8 100644
--- a/salt/gentoo_baseimage/gentoo_baseimage/files/make.conf
+++ b/salt/gentoo_baseimage/gentoo_baseimage/files/make.conf
@@ -4,7 +4,6 @@ CXXFLAGS="${CFLAGS}"
FCFLAGS="${CFLAGS}"
FFLAGS="${CFLAGS}"
USE="cacert -X -webstart -alsa -cups -gtk -vala -introspection"
-ABI_X86="64 32"
PYTHON_TARGETS="python2_7 python3_6 python3_7 python3_8"
PYTHON_SINGLE_TARGET="python3_6"
CURL_SSL="nss"