ci: fix image deploy (#4953)
The Influx deployment pipeline was changed so the an image push is used as a signal for deployment (instead of a magic script that was used before). So we need to adopt our CI to only push images when all tests pass. Old workflow: - build release: builds docker images and push commit-based tags to registry - deploy release: pulls built images from registry, adds+pushes branch tags, calls magic deploy script New workflow: - build release: builds docker image, saves them to disk - deploy release: load image files, tags them, pushes tags You may wonder why there are two steps if we could just use a single one. The reason is: time-to-deploy. We can already build the image while we are waiting for the tests. If the tests fail, the image will just not be published. Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>pull/24376/head
parent
bfddb032ce
commit
2ebb7b195b
.circleci
|
@ -420,8 +420,6 @@ jobs:
|
||||||
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
|
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run: |
|
|
||||||
echo "$QUAY_INFLUXDB_IOX_PASS" | docker login quay.io --username $QUAY_INFLUXDB_IOX_USER --password-stdin
|
|
||||||
- run:
|
- run:
|
||||||
name: Cargo release build with target arch set for CRoaring
|
name: Cargo release build with target arch set for CRoaring
|
||||||
command: |
|
command: |
|
||||||
|
@ -447,10 +445,17 @@ jobs:
|
||||||
|
|
||||||
docker run -it --rm quay.io/influxdb/iox:$COMMIT_SHA debug print-cpu
|
docker run -it --rm quay.io/influxdb/iox:$COMMIT_SHA debug print-cpu
|
||||||
|
|
||||||
docker push quay.io/influxdb/iox:"$COMMIT_SHA"
|
mkdir /tmp/images
|
||||||
docker push quay.io/influxdb/iox_data_generator:"$COMMIT_SHA"
|
docker save quay.io/influxdb/iox:"$COMMIT_SHA" | gzip > /tmp/iox.tar.gz
|
||||||
|
docker save quay.io/influxdb/iox_data_generator:"$COMMIT_SHA" | gzip > /tmp/iox_data_generator.tar.gz
|
||||||
# linking might take a while and doesn't produce CLI output
|
# linking might take a while and doesn't produce CLI output
|
||||||
no_output_timeout: 30m
|
no_output_timeout: 30m
|
||||||
|
- store_artifacts:
|
||||||
|
path: /tmp/images
|
||||||
|
- persist_to_workspace:
|
||||||
|
root: /tmp/images
|
||||||
|
paths:
|
||||||
|
- '*.tar.gz'
|
||||||
- cache_save
|
- cache_save
|
||||||
|
|
||||||
deploy_release:
|
deploy_release:
|
||||||
|
@ -461,30 +466,29 @@ jobs:
|
||||||
version: 19.03.13
|
version: 19.03.13
|
||||||
docker_layer_caching: true
|
docker_layer_caching: true
|
||||||
- checkout
|
- checkout
|
||||||
- run: |
|
- attach_workspace:
|
||||||
echo "$QUAY_INFLUXDB_IOX_PASS" | docker login quay.io --username $QUAY_INFLUXDB_IOX_USER --password-stdin
|
at: /tmp/images
|
||||||
- run:
|
- run:
|
||||||
name: Update docker branch tags
|
name: quay login
|
||||||
|
command: |
|
||||||
|
echo "$QUAY_INFLUXDB_IOX_PASS" | docker login quay.io --username $QUAY_INFLUXDB_IOX_USER --password-stdin
|
||||||
|
- run:
|
||||||
|
name: Upload images
|
||||||
command: |
|
command: |
|
||||||
COMMIT_SHA="$(git rev-parse --short HEAD)"
|
COMMIT_SHA="$(git rev-parse --short HEAD)"
|
||||||
BRANCH="$(echo "$CIRCLE_BRANCH" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/_/g')"
|
BRANCH="$(echo "$CIRCLE_BRANCH" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/_/g')"
|
||||||
|
|
||||||
docker pull quay.io/influxdb/iox:"$COMMIT_SHA"
|
docker load -i /tmp/iox.tar.gz
|
||||||
docker pull quay.io/influxdb/iox_data_generator:"$COMMIT_SHA"
|
docker load -i /tmp/iox_data_generator.tar.gz
|
||||||
|
|
||||||
docker tag quay.io/influxdb/iox:"$COMMIT_SHA" quay.io/influxdb/iox:"$BRANCH"
|
docker tag quay.io/influxdb/iox:"$COMMIT_SHA" quay.io/influxdb/iox:"$BRANCH"
|
||||||
docker tag quay.io/influxdb/iox_data_generator:"$COMMIT_SHA" quay.io/influxdb/iox_data_generator:"$BRANCH"
|
docker tag quay.io/influxdb/iox_data_generator:"$COMMIT_SHA" quay.io/influxdb/iox_data_generator:"$BRANCH"
|
||||||
|
|
||||||
|
docker push quay.io/influxdb/iox:"$COMMIT_SHA"
|
||||||
|
docker push quay.io/influxdb/iox_data_generator:"$COMMIT_SHA"
|
||||||
docker push quay.io/influxdb/iox:"$BRANCH"
|
docker push quay.io/influxdb/iox:"$BRANCH"
|
||||||
docker push quay.io/influxdb/iox_data_generator:"$BRANCH"
|
docker push quay.io/influxdb/iox_data_generator:"$BRANCH"
|
||||||
|
|
||||||
echo "export COMMIT_SHA=${COMMIT_SHA}" >> $BASH_ENV
|
|
||||||
- run:
|
|
||||||
name: Deploy tags
|
|
||||||
command: |
|
|
||||||
echo "$QUAY_PASS" | docker login quay.io --username $QUAY_USER --password-stdin
|
|
||||||
./.circleci/get-deploy-tags.sh "${COMMIT_SHA}"
|
|
||||||
|
|
||||||
# Prepare the CI image used for other tasks.
|
# Prepare the CI image used for other tasks.
|
||||||
#
|
#
|
||||||
# A nightly job (scheduled below in the `workflows` section) to build the CI
|
# A nightly job (scheduled below in the `workflows` section) to build the CI
|
||||||
|
|
Loading…
Reference in New Issue