Skip to content

Commit 01359b9

Browse files
authored
ci: test docker image before publishing (#14504)
1 parent 5876eb7 commit 01359b9

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

.github/workflows/docker_publish.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,9 @@ jobs:
7575
type=schedule,pattern=nightly
7676
type=raw,value=${{ inputs.image_tag || 'trunk' }}
7777
78-
- name: Build and push docker image
78+
- name: Build docker image
7979
uses: docker/build-push-action@v4
8080
with:
81-
push: true
8281
context: .
8382
file: main/.github/docker/Dockerfile
8483
tags: ${{ steps.meta.outputs.tags }}
@@ -87,3 +86,24 @@ jobs:
8786
provenance: false
8887
cache-from: type=s3,name=local_ydb,region=ru-central1,bucket=${{ vars.AWS_BUCKET }},endpoint_url=${{ vars.AWS_ENDPOINT }},access_key_id=${{ secrets.AWS_KEY_ID }},secret_access_key=${{ secrets.AWS_KEY_VALUE }}
8988
cache-to: type=s3,name=local_ydb,region=ru-central1,bucket=${{ vars.AWS_BUCKET }},endpoint_url=${{ vars.AWS_ENDPOINT }},access_key_id=${{ secrets.AWS_KEY_ID }},secret_access_key=${{ secrets.AWS_KEY_VALUE }},mode=max
89+
90+
- name: Test docker image
91+
continue-on-error: false
92+
run: |
93+
docker run -d --name local-ydb-test ghcr.io/${{ github.repository_owner }}/local-ydb:nightly
94+
sleep 61 # Wait for the health check to run (--start-period=60s --interval=1s)
95+
if [ "$(docker inspect --format='{{json .State.Health.Status}}' local-ydb-test)" != "\"healthy\"" ]; then
96+
echo "Container is not healthy"
97+
docker logs local-ydb-test
98+
exit 1
99+
fi
100+
docker stop local-ydb-test
101+
docker rm local-ydb-test
102+
103+
- name: Push docker image
104+
uses: docker/build-push-action@v4
105+
with:
106+
context: .
107+
push: true
108+
tags: ${{ steps.meta.outputs.tags }}
109+
cache-to: type=s3,name=local_ydb,region=ru-central1,bucket=${{ vars.AWS_BUCKET }},endpoint_url=${{ vars.AWS_ENDPOINT }},access_key_id=${{ secrets.AWS_KEY_ID }},secret_access_key=${{ secrets.AWS_KEY_VALUE }},mode=max

0 commit comments

Comments
 (0)