Skip to content

Commit

Permalink
fix: remove deprecated registry login and add env setup (#443)
Browse files Browse the repository at this point in the history
## Description
uds-common removed the task for registry login and moved that logic in
to the env setup github action. This PR reworks our use of the
deprecated registry-login task and uses that env setup.

## Related Issue

Fixes #296 

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Other (security config, docs update, etc)

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/uds-template-capability/blob/main/CONTRIBUTING.md)(https://github.com/defenseunicorns/uds-template-capability/blob/main/CONTRIBUTING.md#submitting-a-pull-request)
followed
  • Loading branch information
UnicornChance authored May 30, 2024
1 parent e1f7879 commit ebd3087
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 25 deletions.
21 changes: 18 additions & 3 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
name: "Setup Environment"
description: "UDS Environment Setup"
inputs:
gh_token:
ghToken:
description: 'GITHUB_TOKEN'
required: true
ib_user:
registry1Username:
description: 'IRON_BANK_ROBOT_USERNAME'
required: true
ib_password:
registry1Password:
description: 'IRON_BANK_ROBOT_PASSWORD'
required: true

Expand All @@ -31,3 +31,18 @@ runs:
shell: bash
# renovate: datasource=github-tags depName=defenseunicorns/uds-cli versioning=semver
run: brew install defenseunicorns/tap/[email protected]

- name: Iron Bank Login
if: ${{ inputs.registry1Username != '' }}
env:
REGISTRY_USERNAME: ${{ inputs.registry1Username }}
REGISTRY_PASSWORD: ${{ inputs.registry1Password }}
run: echo "${{ env.REGISTRY_PASSWORD }}" | uds zarf tools registry login -u "${{ env.REGISTRY_USERNAME }}" --password-stdin registry1.dso.mil
shell: bash

- name: GHCR Login
if: ${{ inputs.ghToken != '' }}
env:
GH_TOKEN: ${{ inputs.ghToken }}
run: echo "${{ env.GH_TOKEN }}" | uds zarf tools registry login -u "dummy" --password-stdin ghcr.io
shell: bash
10 changes: 4 additions & 6 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ jobs:

- name: Environment setup
uses: ./.github/actions/setup

- name: Login to GHCR
run: uds run registry-login --set REGISTRY=ghcr.io --set REGISTRY_USERNAME=dummy --set REGISTRY_PASSWORD=${{ secrets.GITHUB_TOKEN }} --set REGISTRY_RETRY_INTERVAL=90 --no-progress

- name: Login to registry1
run: uds run registry-login --set REGISTRY=registry1.dso.mil --set REGISTRY_USERNAME=${{ secrets.IRON_BANK_ROBOT_USERNAME }} --set REGISTRY_PASSWORD=${{ secrets.IRON_BANK_ROBOT_PASSWORD }} --set REGISTRY_RETRY_INTERVAL=90 --no-progress
with:
registry1Username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }}
registry1Password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }}
ghToken: ${{ secrets.GITHUB_TOKEN }}

- name: (Snapshot) Get snapshot version using git commit short sha and date
if: ${{ inputs.snapshot }}
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,10 @@ jobs:

- name: Environment setup
uses: ./.github/actions/setup

- name: Login to GHCR
run: uds run registry-login --set REGISTRY=ghcr.io --set REGISTRY_USERNAME=dummy --set REGISTRY_PASSWORD=${{ secrets.GITHUB_TOKEN }} --set REGISTRY_RETRY_INTERVAL=90 --no-progress

- name: Login to registry1
run: uds run registry-login --set REGISTRY=registry1.dso.mil --set REGISTRY_USERNAME=${{ secrets.IRON_BANK_ROBOT_USERNAME }} --set REGISTRY_PASSWORD=${{ secrets.IRON_BANK_ROBOT_PASSWORD }} --set REGISTRY_RETRY_INTERVAL=90 --no-progress
with:
registry1Username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }}
registry1Password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }}
ghToken: ${{ secrets.GITHUB_TOKEN }}

- name: Test a single source package
if: ${{ inputs.package != 'all' && inputs.test_type == 'install' }}
Expand Down
10 changes: 0 additions & 10 deletions tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ includes:
- deploy: ./tasks/deploy.yaml
- test: ./tasks/test.yaml
- lint: ./tasks/lint.yaml
- common-setup: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.3.6/tasks/setup.yaml

tasks:

Expand Down Expand Up @@ -61,15 +60,6 @@ tasks:
actions:
- task: setup:k3d-test-cluster

- name: registry-login
actions:
- task: common-setup:registry-login
with:
registry: ${REGISTRY}
registryUsername: ${REGISTRY_USERNAME}
registryPassword: ${REGISTRY_PASSWORD}
registryRetryInterval: ${REGISTRY_RETRY_INTERVAL}

- name: create-single-package
actions:
- task: create:single-package
Expand Down

0 comments on commit ebd3087

Please sign in to comment.