Skip to content

Commit e188b4e

Browse files
authored
Replace docker/login-action with inline docker login (#8694)
Drop dependency on docker/login-action by replacing it with a simple `docker login` command. Just reduces our supply chain exposure a bit. This is done in a way consistent with GitHub's suggestions https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/use-secrets#using-secrets-in-a-workflow, in particular: the secret is passed to the inner step as an environment variable; `printenv` prevents the secret from being visible in the process list, and is piped over stdin to `docker login`.
1 parent 350fe31 commit e188b4e

2 files changed

Lines changed: 9 additions & 15 deletions

File tree

.github/workflows/boulder-ci.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,13 @@ jobs:
7575
with:
7676
persist-credentials: false
7777

78+
# Log into dockerhub to avoid rate limits.
7879
- name: Docker Login
79-
# You may pin to the exact commit or the version.
80-
# uses: docker/login-action@f3364599c6aa293cdc2b8391b1b56d0c30e45c8a
81-
uses: docker/login-action@v3.6.0
82-
with:
83-
# Username used to log against the Docker registry
84-
username: ${{ secrets.DOCKER_USERNAME}}
85-
# Password or personal access token used to log against the Docker registry
86-
password: ${{ secrets.DOCKER_PASSWORD}}
87-
# Log out from the Docker registry at the end of a job
88-
logout: true
80+
run: printenv DOCKER_PASSWORD | docker login -u "$DOCKER_USERNAME" --password-stdin docker.io
81+
env:
82+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
83+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
84+
# This task is best-effort, if it fails, e.g. due to running from a fork, it's no big deal.
8985
continue-on-error: true
9086

9187
# Print the env variable being used to pull the docker image. For

.github/workflows/release.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,9 @@ jobs:
7171
run: docker buildx build . --build-arg "GO_VERSION=${{ matrix.GO_VERSION }}" -f test/ct-test-srv/Dockerfile -t "ghcr.io/letsencrypt/ct-test-srv:${GITHUB_REF_NAME}-go${{ matrix.GO_VERSION }}"
7272

7373
- name: Login to GitHub Container Registry
74-
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
75-
with:
76-
registry: ghcr.io
77-
username: ${{ github.actor }}
78-
password: ${{ secrets.GITHUB_TOKEN }}
74+
run: printenv GITHUB_TOKEN | docker login -u "$GITHUB_ACTOR" --password-stdin ghcr.io
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7977

8078
- name: Push Boulder container
8179
run: docker push "ghcr.io/letsencrypt/boulder:${GITHUB_REF_NAME}-go${{ matrix.GO_VERSION }}"

0 commit comments

Comments
 (0)