diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index 9ec95d9d..f67870fa 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -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 @@ -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 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 6328716b..d158e6bf 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 94e2d579..bcbde1c9 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-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