Skip to content

Commit

Permalink
feat(gradle): login to Docker Hub if credentials are provided
Browse files Browse the repository at this point in the history
...because this may be needed if testcontainers tests are included.
Testcontainers will pick up the docker login in case it needs to pull
images based on the configure image pull policy.
  • Loading branch information
stempler committed Oct 11, 2024
1 parent 29e290c commit 646fe8e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/gradle-library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,20 @@ jobs:
# fetch-depth 0 is required to fetch all tags (and to determine the version based on tags)
fetch-depth: ${{ inputs.publish-tasks != '' && '0' || '1' }}

#
# Login to Docker Hub
#
# May be required for pulling images for testcontainers
#
- name: Login to DockerHub
if: env.DOCKER_HUB_USERNAME
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}

#
# Build, test and create Docker image
#
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/gradle-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,20 @@ jobs:
done
fi
#
# Login to Docker Hub
#
# May be required for pulling images for testcontainers
#
- name: Login to DockerHub
if: env.DOCKER_HUB_USERNAME
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}

#
# Build, test and create Docker image
#
Expand Down

0 comments on commit 646fe8e

Please sign in to comment.