ci: Run a small test on fat image before pushing to DockerHub (#8619)
This commit is contained in:
parent
199927b32e
commit
334e1dce1d
22
.github/workflows/test-build-docker-image.yml
vendored
22
.github/workflows/test-build-docker-image.yml
vendored
|
|
@ -617,7 +617,6 @@ jobs:
|
||||||
|
|
||||||
docker buildx build \
|
docker buildx build \
|
||||||
--platform linux/arm64,linux/amd64 \
|
--platform linux/arm64,linux/amd64 \
|
||||||
--push \
|
|
||||||
--build-arg APPSMITH_SEGMENT_CE_KEY=${{ secrets.APPSMITH_SEGMENT_CE_KEY_RELEASE }} \
|
--build-arg APPSMITH_SEGMENT_CE_KEY=${{ secrets.APPSMITH_SEGMENT_CE_KEY_RELEASE }} \
|
||||||
$tag_args \
|
$tag_args \
|
||||||
.
|
.
|
||||||
|
|
@ -631,11 +630,30 @@ jobs:
|
||||||
|
|
||||||
docker buildx build \
|
docker buildx build \
|
||||||
--platform linux/arm64,linux/amd64 \
|
--platform linux/arm64,linux/amd64 \
|
||||||
--push \
|
|
||||||
--build-arg APPSMITH_SEGMENT_CE_KEY=${{ secrets.APPSMITH_SEGMENT_CE_KEY }} \
|
--build-arg APPSMITH_SEGMENT_CE_KEY=${{ secrets.APPSMITH_SEGMENT_CE_KEY }} \
|
||||||
$tag_args \
|
$tag_args \
|
||||||
.
|
.
|
||||||
|
|
||||||
|
- name: Check and push fat image to Docker Hub with commit tag
|
||||||
|
if: success() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/release') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
|
||||||
|
working-directory: "."
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then
|
||||||
|
tag=nightly
|
||||||
|
else
|
||||||
|
tag="${{ steps.vars.outputs.tag }}"
|
||||||
|
fi
|
||||||
|
docker run --detach --publish 80:80 --name appsmith \
|
||||||
|
"${{ secrets.DOCKER_HUB_ORGANIZATION }}/appsmith-ce:$tag"
|
||||||
|
sleep 180
|
||||||
|
cd deploy/docker
|
||||||
|
if bash run-test.sh; then
|
||||||
|
echo "Fat container test passed. Pushing image."
|
||||||
|
docker push --all-tags ${{ secrets.DOCKER_HUB_ORGANIZATION }}/appsmith-ce
|
||||||
|
else
|
||||||
|
echo "Fat container test FAILED. Not pushing image."
|
||||||
|
fi
|
||||||
|
|
||||||
# Build release Docker image and push to Docker Hub
|
# Build release Docker image and push to Docker Hub
|
||||||
- name: Push server release image to Docker Hub
|
- name: Push server release image to Docker Hub
|
||||||
if: success() && github.ref == 'refs/heads/release'
|
if: success() && github.ref == 'refs/heads/release'
|
||||||
|
|
|
||||||
63
deploy/docker/run-test.sh
Normal file
63
deploy/docker/run-test.sh
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o pipefail
|
||||||
|
set -o nounset
|
||||||
|
set -o xtrace
|
||||||
|
|
||||||
|
# User credential to register on app
|
||||||
|
email=example%40appsmith.com
|
||||||
|
password=dummypass123
|
||||||
|
|
||||||
|
# Backend API
|
||||||
|
status_code="$(
|
||||||
|
curl --silent --show-error --output /dev/null --head --write-out "%{http_code}" "http://localhost/api/v1/users/me"
|
||||||
|
)"
|
||||||
|
|
||||||
|
# Create account
|
||||||
|
status_code_register="$(curl --silent --show-error \
|
||||||
|
--request POST --write-out "%{http_code}" --silent --output /dev/null \
|
||||||
|
--header "Content-Type: application/x-www-form-urlencoded" \
|
||||||
|
--header "Referer: http://localhost/user/signup" \
|
||||||
|
--data-raw "email=$email&password=$password" \
|
||||||
|
"http://localhost/api/v1/users"
|
||||||
|
)"
|
||||||
|
|
||||||
|
# Login
|
||||||
|
status_code_login="$(curl --silent --show-error \
|
||||||
|
--request POST --write-out "%{http_code}" --silent --output /dev/null \
|
||||||
|
--header "Referer: http://localhost/user/login" \
|
||||||
|
--data-raw "username=$email&password=$password" \
|
||||||
|
"http://localhost/api/v1/login"
|
||||||
|
)"
|
||||||
|
|
||||||
|
count_fail=0
|
||||||
|
|
||||||
|
if [[ $status_code -eq 200 ]]; then
|
||||||
|
echo "Api backend succeeded, status code: $status_code"
|
||||||
|
else
|
||||||
|
echo "Api backend failed, status code: $status_code"
|
||||||
|
count_fail=$((count_fail + 1))
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $status_code_register -eq 302 ]]; then
|
||||||
|
echo "Register succeeded, status code: $status_code_register"
|
||||||
|
else
|
||||||
|
echo "Register failed, status code: $status_code_register"
|
||||||
|
count_fail=$((count_fail + 1))
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $status_code_login -eq 302 ]]; then
|
||||||
|
echo "Login succeeded, status code: $status_code_login"
|
||||||
|
else
|
||||||
|
echo "Login failed, status code: $status_code_login"
|
||||||
|
count_fail=$((count_fail + 1))
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $count_fail -eq 0 ]]; then
|
||||||
|
echo "SUCCEEDED!!!"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "FAILED!!!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Loading…
Reference in New Issue
Block a user