Skip to content

Commit

Permalink
DAT-18340 DevOps :: Docker official PR wrong commit (#328)
Browse files Browse the repository at this point in the history
* 🔧 (.github/workflows/create-release.yml): add latestCommitSha output to collect and use the latest commit SHA for the release process. Update GitCommit value in the liquibase file to use the latest commit SHA instead of the github.sha value.

* 🔧 (test.yml): increase sleep time from 20 to 30 seconds for better stability and reliability in docker container startup and shutdown operations.
  • Loading branch information
jandroav authored Aug 2, 2024
1 parent 07e271e commit e5b8b69
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
liquibaseVersion: ${{ steps.collect-data.outputs.liquibaseVersion }}
extensionVersion: ${{ steps.collect-data.outputs.extensionVersion }}
minorVersion: ${{ steps.collect-data.outputs.minorVersion }}
latestCommitSha: ${{ steps.get-latest-sha.outputs.latestCommitSha }}

steps:
- name: Collect Data
id: collect-data
Expand Down Expand Up @@ -93,6 +95,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}

- name: Get latest commit SHA
id: get-latest-sha
run: echo "latestCommitSha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"

setup-update-draft-build:
name: "${{ matrix.image.name }}:${{ inputs.liquibaseVersion}}${{ matrix.image.suffix }}"
needs: update-dockerfiles
Expand Down Expand Up @@ -184,12 +190,12 @@ jobs:
echo "" >> library/liquibase
echo "Tags: ${{ env.MAJOR_MINOR }}, ${{ needs.update-dockerfiles.outputs.liquibaseVersion }}, latest" >> library/liquibase
echo "GitFetch: refs/heads/main" >> library/liquibase
echo "GitCommit: ${{ github.sha }}" >> library/liquibase
echo "GitCommit: ${{ needs.update-dockerfiles.outputs.latestCommitSha }}" >> library/liquibase
echo "File: Dockerfile" >> library/liquibase
echo "" >> library/liquibase
echo "Tags: ${{ env.MAJOR_MINOR }}-alpine, ${{ needs.update-dockerfiles.outputs.liquibaseVersion }}-alpine, alpine" >> library/liquibase
echo "GitFetch: refs/heads/main" >> library/liquibase
echo "GitCommit: ${{ github.sha }}" >> library/liquibase
echo "GitCommit: ${{ needs.update-dockerfiles.outputs.latestCommitSha }}" >> library/liquibase
echo "File: Dockerfile.alpine" >> library/liquibase
git add library/liquibase
if git diff-index --cached --quiet HEAD --
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
run: |
LOG_STRING="The database does not persist data"
docker run --name $CONTAINER_NAME -d -v $(pwd)/.github/test:/liquibase/changelog liquibase/liquibase:${{ github.sha }} init start-h2
sleep 20
sleep 30
# Check if the container is running
if docker inspect -f '{{.State.Running}}' "$CONTAINER_NAME" 2>/dev/null | grep -q "true"; then
# Get the logs and check if the desired string is present
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
docker rm $CONTAINER_NAME
# Start docker container with good ENV
docker run --name $CONTAINER_NAME -d -v $(pwd)/.github/test:/liquibase/changelog -e LIQUIBASE_HOME="/liquibase" liquibase/liquibase:${{ github.sha }} init start-h2
sleep 20
sleep 30
docker logs $CONTAINER_NAME
# Check if the container is running
if docker inspect -f '{{.State.Running}}' "$CONTAINER_NAME" 2>/dev/null | grep -q "true"; then
Expand All @@ -141,7 +141,7 @@ jobs:
docker stop $CONTAINER_NAME
# Start docker container
docker start $CONTAINER_NAME
sleep 5
sleep 30
# Check if the container is running
if docker inspect -f '{{.State.Running}}' "$CONTAINER_NAME" 2>/dev/null | grep -q "true"; then
# Get the logs and check if the desired string is present
Expand Down

0 comments on commit e5b8b69

Please sign in to comment.