Last active
December 2, 2020 21:32
-
-
Save nickboldt/a884449ada7a6cdcda85e58c984b5eea to your computer and use it in GitHub Desktop.
2 ways to do github action to authenticate against registry.redhat.io
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test crw-build token for authenticated connection to RHEC (option 1) | |
# note, this only works against pull requests from the origin fork (redhat-developer, eclipse), not from personal forks, | |
# as secrets cannot be copied to user forks and end up being blank | |
on: [pull_request] | |
jobs: | |
job1: | |
runs-on: ubuntu-18.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Login to RHEC | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.CRW_BUILD_USER }} | |
password: ${{ secrets.CRW_BUILD_TOKEN }} | |
registry: registry.redhat.io | |
- name: Test authenticated connection | |
run: | | |
set -x | |
set +e | |
docker pull registry.redhat.io/codeready-workspaces/imagepuller-rhel8:2.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test crw-build token for authenticated connection to RHEC (option 2) | |
# note, this only works against pull requests from the origin fork (redhat-developer, eclipse), not from personal forks, | |
# as secrets cannot be copied to user forks and end up being blank | |
on: [pull_request] | |
jobs: | |
job1: | |
runs-on: ubuntu-18.04 | |
env: | |
CRW_BUILD_USER: ${{ secrets.CRW_BUILD_USER }} | |
CRW_BUILD_TOKEN: ${{ secrets.CRW_BUILD_TOKEN }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Login to RHEC + test authenticated connection | |
run: | | |
set -x | |
set +e | |
echo "[INFO]: Log into registry.redhat.io as ${CRW_BUILD_USER} ..." | |
echo "${CRW_BUILD_TOKEN}" | docker login -u="${CRW_BUILD_USER}" --password-stdin registry.redhat.io | |
docker pull registry.redhat.io/codeready-workspaces/imagepuller-rhel8:2.5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output from v1:
then
Output from v2: