diff --git a/.github/actions/ironbank-setup/action.yaml b/.github/actions/ironbank-setup/action.yaml new file mode 100644 index 00000000..4df5d119 --- /dev/null +++ b/.github/actions/ironbank-setup/action.yaml @@ -0,0 +1,85 @@ +# Copyright 2024 Defense Unicorns +# SPDX-License-Identifier: Apache-2.0 + +name: "Pepr Iron Bank Setup" +description: "Pepr Iron Bank Environment Setup" +inputs: + registry1Username: + description: 'IRON_BANK_ROBOT_USERNAME' + required: true + registry1Password: + description: 'IRON_BANK_ROBOT_PASSWORD' + required: true + +runs: + using: "composite" + steps: + - name: Harden Runner + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 + with: + egress-policy: audit + + - name: Use Node.js 22 + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 + with: + node-version: 22 + + - name: Install k3d + shell: bash + run: curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash + + - 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: Clone Pepr + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: defenseunicorns/pepr + path: pepr + + - name: Set Pepr Environment Variable + shell: bash + run: echo "PEPR=${GITHUB_WORKSPACE}/pepr" >> "$GITHUB_ENV" + + - name: Clone Iron Bank Repo & Transfer Dockerfiles + shell: bash + run: | + git clone https://repo1.dso.mil/dsop/opensource/defenseunicorns/pepr/controller.git + cd controller + git checkout development + mv Dockerfile $PEPR/Dockefile.ironbank.amd + mv Dockerfile.arm $PEPR/Dockerfile.ironbank.arm + + - name: Install Pepr Dependencies + shell: bash + run: | + cd "$PEPR" + npm ci + + - name: Build Pepr Iron Bank Images + shell: bash + run: | + cd "$PEPR" + docker build -t pepr:amd -f Dockerfile.ironbank.amd . + docker build -t pepr:arm -f Dockerfile.ironbank.arm . + + - name: Import Pepr Iron Bank Images into K3d cluster + shell: bash + run: | + cd "$PEPR" + npm run build + mv pepr-0.0.0-development.tgz ${GITHUB_WORKSPACE}/pepr-0.0.0-development.tgz + docker build -t pepr:amd -f Dockerfile.ironbank.amd . + docker build -t pepr:arm -f Dockerfile.ironbank.arm . + + - name: Create K3d Cluster & Import Pepr Iron Bank Images + shell: bash + run: | + k3d cluster create iron-bank-pepr-e2es + k3d image import pepr:amd pepr:arm -c iron-bank-pepr-e2es +