Skip to content

Commit 33c05c4

Browse files
polRkblinkov
authored andcommitted
ci: test docker image before publishing (#14519)
1 parent 3230555 commit 33c05c4

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

.github/workflows/docker_publish.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,33 @@ jobs:
7979
uses: docker/build-push-action@v4
8080
with:
8181
context: .
82+
load: true
8283
file: main/.github/docker/Dockerfile
8384
tags: ${{ steps.meta.outputs.tags }}
8485
labels: ${{ steps.meta.outputs.labels }}
8586
platforms: linux/amd64
8687
provenance: false
8788
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 }}
89+
90+
- name: Test docker image
91+
continue-on-error: false
92+
run: |
93+
docker run -d --rm --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 inspect --format='{{json .State.Health}}' local-ydb-test
98+
docker logs local-ydb-test
99+
exit 1
100+
fi
101+
docker stop local-ydb-test
102+
docker rm local-ydb-test
103+
104+
- name: Push docker image
105+
uses: docker/build-push-action@v4
106+
with:
107+
push: true
108+
tags: ${{ steps.meta.outputs.tags }}
88109
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
89110

90111
- name: Test docker image

0 commit comments

Comments
 (0)