Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update registry login to happen in the common env setup action #88

Merged
merged 5 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: Setup Environment
description: UDS Environment Setup

inputs:
username:
description: registry1 user
required: true
password:
description: registry1 password
required: true
registry1Username:
description: Registry1 Username
registry1Password:
description: Registry1 Password
ghToken:
description: GitHub Token

runs:
using: composite
Expand All @@ -26,8 +26,16 @@ runs:
run: brew install defenseunicorns/tap/uds@0.9.4

- name: Iron Bank Login
if: ${{ inputs.registry1Username != '' }}
env:
REGISTRY_USERNAME: ${{ inputs.username }}
REGISTRY_PASSWORD: ${{ inputs.password }}
run: uds zarf tools registry login -u "${{ env.REGISTRY_USERNAME }}" -p "${{ env.REGISTRY_PASSWORD }}" registry1.dso.mil
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
14 changes: 3 additions & 11 deletions .github/workflows/test-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,9 @@ jobs:
- name: Environment setup
uses: ./.github/actions/setup
with:
username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }}
password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }}

- name: Login to ghcr
env:
REGISTRY: ghcr.io
REGISTRY_USERNAME: dummy
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
REGISTRY_RETRY_INTERVAL: "5"
run: |
uds run registry-login
registry1Username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }}
registry1Password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }}
ghToken: ${{ secrets.GITHUB_TOKEN }}

- name: Test
uses: ./.github/actions/test
Expand Down
10 changes: 0 additions & 10 deletions tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@ includes:
- publish: ./tasks/publish.yaml

tasks:
- name: registry-login
description: Authenticate to registry (registry1 defualt)
actions:
- task: setup:registry-login
with:
registry: ${REGISTRY}
registryUsername: ${REGISTRY_USERNAME}
registryPassword: ${REGISTRY_PASSWORD}
registryRetryInterval: ${REGISTRY_RETRY_INTERVAL}

- name: create-podinfo-package
description: Create UDS Podinfo Package
actions:
Expand Down
27 changes: 0 additions & 27 deletions tasks/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,3 @@ tasks:
- description: Create k3d cluster with UDS Core Istio
# renovate: datasource=github-tags depName=defenseunicorns/uds-core versioning=semver
cmd: uds deploy oci://defenseunicorns/uds/bundles/k3d-core-slim-dev:0.17.0 --confirm --no-progress

- name: registry-login
inputs:
registry:
description: Registry
registryUsername:
description: Registry username
registryPassword:
description: Registry password
registryRetryInterval:
default: "5"
description: Registry retry interval
actions:
- cmd: |
echo ${{ .inputs.registryPassword }} | \
uds zarf tools registry login \
--username ${{ .inputs.registryUsername }} \
--password-stdin ${{ .inputs.registry }} \
>/dev/null
description: Authenticate to the registry
- cmd: |
if [ ${{ .inputs.registry }} = "registry1.dso.mil" ]; then
uds zarf tools registry digest "${REGISTRY1_TEST_IMAGE}" >/dev/null || \
(sleep ${{ .inputs.registryRetryInterval }}; exit 1)
fi
description: Validate registry connection
maxRetries: 10
Loading