diff options
author | Nathaniel Kierpiec <nkierpiec@chef.io> | 2021-07-16 14:42:35 -0400 |
---|---|---|
committer | Nathaniel Kierpiec <nkierpiec@chef.io> | 2021-07-28 10:19:22 -0400 |
commit | 38f56ecbf358e0f89fa8fca48a392fe3d4287329 (patch) | |
tree | f94d3900ac6e9002ea4a40a9833ad360bbbcfd06 /.expeditor | |
parent | c0d2545060a09668367b34e67fd5bf1b7766f29f (diff) | |
download | chef-38f56ecbf358e0f89fa8fca48a392fe3d4287329.tar.gz |
Add new general use pipeline for building on multiple os/arch
Signed-off-by: Nathaniel Kierpiec <nkierpiec@chef.io>
Diffstat (limited to '.expeditor')
-rw-r--r-- | .expeditor/build-docker-images.sh | 21 | ||||
-rw-r--r-- | .expeditor/docker-build.pipeline.yml | 22 | ||||
-rw-r--r-- | .expeditor/promote-docker-images.sh | 42 |
3 files changed, 68 insertions, 17 deletions
diff --git a/.expeditor/build-docker-images.sh b/.expeditor/build-docker-images.sh new file mode 100644 index 0000000000..becf90b484 --- /dev/null +++ b/.expeditor/build-docker-images.sh @@ -0,0 +1,21 @@ +#! /bin/bash + +export DOCKER_CLI_EXPERIMENTAL=enabled + +arch=$1 + +echo "--- Building chef/chef:${EXPEDITOR_VERSION} docker image for ${arch}" +docker build \ + --build-arg "CHANNEL=${EXPEDITOR_CHANNEL}" \ + --build-arg "VERSION=${EXPEDITOR_VERSION}" \ + -t "chef/chef:${EXPEDITOR_VERSION}-${arch}" . + +echo "--- Pushing chef/chef:${EXPEDITOR_VERSION} docker image for ${arch} to dockerhub" +docker push "chef/chef:${EXPEDITOR_VERSION}-${arch}" + +echo "--- Creating chef/chef:${EXPEDITOR_VERSION} multiarch manifest" +docker manifest create "chef/chef:${EXPEDITOR_VERSION}" \ + --amend "chef/chef:${EXPEDITOR_VERSION}-${arch}" + +echo "--- Pushing chef/chef:${EXPEDITOR_VERSION} multiarch manifest" +docker manifest push "chef/chef:${EXPEDITOR_VERSION}"
\ No newline at end of file diff --git a/.expeditor/docker-build.pipeline.yml b/.expeditor/docker-build.pipeline.yml index 5d15bb27f2..30820d9169 100644 --- a/.expeditor/docker-build.pipeline.yml +++ b/.expeditor/docker-build.pipeline.yml @@ -1,23 +1,11 @@ --- -env: - IMAGE_REGISTRY: chef - BUILDKITE_PLUGIN_DOBI_S3_BUCKET_NAME: docker-buildkite-cache-chef-prod steps: -- id: chef - label: ":docker: build chef" +- label: ":docker: build chef amd64" agents: queue: docker-linux - plugins: - - chef/dobi#v0.1.1: - tasks: - - chef:build - - chef:tag -- id: chef-arm64 - label: ":docker: build chef arm64" + command: .expeditor/build-docker-images.sh amd64 + +- label: ":docker: build chef arm64" agents: queue: docker-linux-arm64 - plugins: - - chef/dobi#v0.1.1: - tasks: - - chef:build - - chef:tag
\ No newline at end of file + command: .expeditor/build-docker-images.sh arm64
\ No newline at end of file diff --git a/.expeditor/promote-docker-images.sh b/.expeditor/promote-docker-images.sh new file mode 100644 index 0000000000..32b4aea9d1 --- /dev/null +++ b/.expeditor/promote-docker-images.sh @@ -0,0 +1,42 @@ +#! /bin/bash + +export DOCKER_CLI_EXPERIMENTAL=enabled + +VERSION=$(cat VERSION) + +echo "--- Creating manifest for ${EXPEDITOR_TARGET_CHANNEL}" +docker manifest create "chef/chef:${EXPEDITOR_TARGET_CHANNEL}" \ + --amend "chef/chef:${VERSION}-arm64" \ + --amend "chef/chef:${VERSION}-amd64" + +echo "--- Pushing manifest for ${EXPEDITOR_TARGET_CHANNEL}" +docker manifest push "chef/chef:${EXPEDITOR_TARGET_CHANNEL}" + +if [[ $EXPEDITOR_TARGET_CHANNEL == "stable" ]]; then + echo "--- Creating manifest for latest" + docker manifest create "chef/chef:latest" \ + --amend "chef/chef:${VERSION}-arm64" \ + --amend "chef/chef:${VERSION}-amd64" + + echo "--- Pushing manifest for latest" + docker manifest push "chef/chef:latest" + + # split the version and add the tags for major and major.minor + version=(${VERSION//./ }) + + echo "--- Creating manifest for ${version[0]}" + docker manifest create "chef/chef:${version[0]}" \ + --amend "chef/chef:${VERSION}-arm64" \ + --amend "chef/chef:${VERSION}-amd64" + + echo "--- Pushing manifest for ${version[0]}" + docker manifest push "chef/chef:${version[0]}" + + echo "--- Creating manifest for ${version[0]}.${version[1]}" + docker manifest create "chef/chef:${version[0]}.${version[1]}" \ + --amend "chef/chef:${VERSION}-arm64" \ + --amend "chef/chef:${VERSION}-amd64" + + echo "--- Pushing manifest for ${version[0]}.${version[1]}" + docker manifest push "chef/chef:${version[0]}.${version[1]}" +fi
\ No newline at end of file |