diff options
author | Nathaniel Kierpiec <nkierpiec@chef.io> | 2021-07-29 12:06:41 -0400 |
---|---|---|
committer | Nathaniel Kierpiec <nkierpiec@chef.io> | 2021-07-29 12:06:41 -0400 |
commit | 4522dc91c4ba8f793cffc81b65624a210587a061 (patch) | |
tree | eb31e846195ebf0d5486dc9d35218027dbf712dc | |
parent | 1021d5e517c65dabde7902bcad35e439156dcc19 (diff) | |
download | chef-4522dc91c4ba8f793cffc81b65624a210587a061.tar.gz |
clean up scripts and docker login to auth to chef docker org
Signed-off-by: Nathaniel Kierpiec <nkierpiec@chef.io>
-rwxr-xr-x | .expeditor/build-docker-images.sh | 14 | ||||
-rwxr-xr-x | .expeditor/docker-manifest-create.sh | 11 | ||||
-rwxr-xr-x | .expeditor/promote-docker-images.sh | 24 |
3 files changed, 32 insertions, 17 deletions
diff --git a/.expeditor/build-docker-images.sh b/.expeditor/build-docker-images.sh index 73fafa5d99..72f3d4fc5b 100755 --- a/.expeditor/build-docker-images.sh +++ b/.expeditor/build-docker-images.sh @@ -2,12 +2,14 @@ set -eu -o pipefail arch=$1 +channel="${EXPEDITOR_CHANNEL:-unstable}" +version="${EXPEDITOR_VERSION:?You must manually set the EXPEDITOR_VERSION environment variable to an existing semantic version.}" -echo "--- Building chef/chef:${EXPEDITOR_VERSION} docker image for ${arch}" +echo "--- Building chef/chef:${version} docker image for ${arch}" docker build \ - --build-arg "CHANNEL=${EXPEDITOR_CHANNEL}" \ - --build-arg "VERSION=${EXPEDITOR_VERSION}" \ - -t "chef/chef:${EXPEDITOR_VERSION}-${arch}" . + --build-arg "CHANNEL=${channel}" \ + --build-arg "VERSION=${version}" \ + -t "chef/chef:${version}-${arch}" . -echo "--- Pushing chef/chef:${EXPEDITOR_VERSION} docker image for ${arch} to dockerhub" -docker push "chef/chef:${EXPEDITOR_VERSION}-${arch}"
\ No newline at end of file +echo "--- Pushing chef/chef:${version} docker image for ${arch} to dockerhub" +docker push "chef/chef:${version}-${arch}"
\ No newline at end of file diff --git a/.expeditor/docker-manifest-create.sh b/.expeditor/docker-manifest-create.sh index 267159b8f7..b01038895d 100755 --- a/.expeditor/docker-manifest-create.sh +++ b/.expeditor/docker-manifest-create.sh @@ -3,18 +3,21 @@ set -eu -o pipefail export DOCKER_CLI_EXPERIMENTAL=enabled +channel="${EXPEDITOR_CHANNEL:-unstable}" +version="${EXPEDITOR_VERSION:?You must manually set the EXPEDITOR_VERSION environment variable to an existing semantic version.}" + function create_and_push_manifest() { manifest_tag="${1}" echo "--- Creating manifest for ${manifest_tag}" docker manifest create "chef/chef:${manifest_tag}" \ - --amend "chef/chef:${EXPEDITOR_VERSION}-arm64" \ - --amend "chef/chef:${EXPEDITOR_VERSION}-amd64" + --amend "chef/chef:${version}-arm64" \ + --amend "chef/chef:${version}-amd64" echo "--- Pushing manifest for ${manifest_tag}" docker manifest push "chef/chef:${manifest_tag}" } # create the initial version and initial channel docker images -create_and_push_manifest "${EXPEDITOR_VERSION}" -create_and_push_manifest "${EXPEDITOR_CHANNEL}"
\ No newline at end of file +create_and_push_manifest "${version}" +create_and_push_manifest "${channel}"
\ No newline at end of file diff --git a/.expeditor/promote-docker-images.sh b/.expeditor/promote-docker-images.sh index 9625fed16b..47ccbb8a20 100755 --- a/.expeditor/promote-docker-images.sh +++ b/.expeditor/promote-docker-images.sh @@ -3,30 +3,40 @@ set -eu -o pipefail export DOCKER_CLI_EXPERIMENTAL=enabled +channel="${EXPEDITOR_CHANNEL:-unstable}" +version="${EXPEDITOR_VERSION:?You must manually set the EXPEDITOR_VERSION environment variable to an existing semantic version.}" + +docker_login_user="expeditor" +docker_login_password="$(vault read -field=expeditor-full-access secret/docker/expeditor)" + +# login to docker +echo "--- Docker login so we can push to chef org" +docker login -u "${docker_login_user}" -p "${docker_login_password}" + function create_and_push_manifest() { manifest_tag="${1}" echo "--- Creating manifest for ${manifest_tag}" docker manifest create "chef/chef:${manifest_tag}" \ - --amend "chef/chef:${EXPEDITOR_VERSION}-arm64" \ - --amend "chef/chef:${EXPEDITOR_VERSION}-amd64" + --amend "chef/chef:${version}-arm64" \ + --amend "chef/chef:${version}-amd64" echo "--- Pushing manifest for ${manifest_tag}" docker manifest push "chef/chef:${manifest_tag}" } # create the promoted channel docker image -create_and_push_manifest "${EXPEDITOR_CHANNEL}" +create_and_push_manifest "${channel}" -if [[ ${EXPEDITOR_CHANNEL} == "stable" ]]; then +if [[ ${channel} == "stable" ]]; then create_and_push_manifest "latest" # split the version and add the tags for major and major.minor - version=(${EXPEDITOR_VERSION//./ }) + IFS="."; read -ra split_version <<< "${version}" # major version - create_and_push_manifest "${version[0]}" + create_and_push_manifest "${split_version[0]}" # major.minor version - create_and_push_manifest "${version[0]}.${version[1]}" + create_and_push_manifest "${split_version[0]}.${split_version[1]}" fi
\ No newline at end of file |