From 948a2080b574968a39486889a4aef1e9893c4664 Mon Sep 17 00:00:00 2001 From: Wayne Starr Date: Tue, 26 Mar 2024 16:39:38 -0600 Subject: [PATCH 1/4] chore: update registry login to happen in the common env setup action --- .github/actions/setup/action.yaml | 19 ++++++++++++++----- .github/workflows/test-deploy.yaml | 14 +++----------- tasks.yaml | 10 ---------- tasks/setup.yaml | 27 --------------------------- 4 files changed, 17 insertions(+), 53 deletions(-) diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index 9ec95d9d..3783094c 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -2,10 +2,13 @@ name: Setup Environment description: UDS Environment Setup inputs: - username: + registry1Username: description: registry1 user required: true - password: + registry1Password: + description: registry1 password + required: true + ghToken: description: registry1 password required: true @@ -27,7 +30,13 @@ runs: - name: Iron Bank Login 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 + env: + GH_TOKEN: ${{ inputs.ghToken }} + run: echo "${{ env.GH_TOKEN }}" | uds zarf tools registry login -u "dummy" --password-stdin ghcr.io shell: bash diff --git a/.github/workflows/test-deploy.yaml b/.github/workflows/test-deploy.yaml index f9173490..f7fc26d3 100644 --- a/.github/workflows/test-deploy.yaml +++ b/.github/workflows/test-deploy.yaml @@ -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 diff --git a/tasks.yaml b/tasks.yaml index 9e3288ac..72e0926f 100644 --- a/tasks.yaml +++ b/tasks.yaml @@ -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: diff --git a/tasks/setup.yaml b/tasks/setup.yaml index 9c7f736d..fe58ff25 100644 --- a/tasks/setup.yaml +++ b/tasks/setup.yaml @@ -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-istio-dev:0.16.1 --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 From b364de28cb67cd65da9909aede982982ebed324b Mon Sep 17 00:00:00 2001 From: Wayne Starr Date: Tue, 26 Mar 2024 16:41:11 -0600 Subject: [PATCH 2/4] fix descs --- .github/actions/setup/action.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index 3783094c..b08683c5 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -3,13 +3,13 @@ description: UDS Environment Setup inputs: registry1Username: - description: registry1 user + description: Registry1 Username required: true registry1Password: - description: registry1 password + description: Registry1 Password required: true ghToken: - description: registry1 password + description: GitHub Token required: true runs: From cddbd8d47b45ecd685a66ee3b054f9d288dcaaac Mon Sep 17 00:00:00 2001 From: Wayne Starr Date: Tue, 26 Mar 2024 16:49:13 -0600 Subject: [PATCH 3/4] add ifs to the common setup action --- .github/actions/setup/action.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index b08683c5..183d58c1 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -4,13 +4,10 @@ description: UDS Environment Setup inputs: registry1Username: description: Registry1 Username - required: true registry1Password: description: Registry1 Password - required: true ghToken: description: GitHub Token - required: true runs: using: composite @@ -29,6 +26,7 @@ runs: run: brew install defenseunicorns/tap/uds@0.9.4 - name: Iron Bank Login + if: ${{ inputs.registry1Username != "" }} env: REGISTRY_USERNAME: ${{ inputs.registry1Username }} REGISTRY_PASSWORD: ${{ inputs.registry1Password }} @@ -36,6 +34,7 @@ runs: 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 From 55047cfc63bc3fe49726e66998f9107d92421084 Mon Sep 17 00:00:00 2001 From: Wayne Starr Date: Tue, 26 Mar 2024 16:53:55 -0600 Subject: [PATCH 4/4] gets me every time --- .github/actions/setup/action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index 183d58c1..f67870fa 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -26,7 +26,7 @@ runs: run: brew install defenseunicorns/tap/uds@0.9.4 - name: Iron Bank Login - if: ${{ inputs.registry1Username != "" }} + if: ${{ inputs.registry1Username != '' }} env: REGISTRY_USERNAME: ${{ inputs.registry1Username }} REGISTRY_PASSWORD: ${{ inputs.registry1Password }} @@ -34,7 +34,7 @@ runs: shell: bash - name: GHCR Login - if: ${{ inputs.ghToken != "" }} + if: ${{ inputs.ghToken != '' }} env: GH_TOKEN: ${{ inputs.ghToken }} run: echo "${{ env.GH_TOKEN }}" | uds zarf tools registry login -u "dummy" --password-stdin ghcr.io