diff options
Diffstat (limited to 'salt')
| -rw-r--r-- | salt/gentoo_baseimage/ci/files/build.sh | 13 | ||||
| -rw-r--r-- | salt/gentoo_baseimage/gentoo_baseimage/files/build.sh | 4 | ||||
| -rw-r--r-- | salt/gentoo_baseimage/gentoo_baseimage/files/make.conf | 1 |
3 files changed, 9 insertions, 9 deletions
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" |
