Skip to content

Commit

Permalink
fix action now that we have presubmit tests (#5)
Browse files Browse the repository at this point in the history
also test action post-submit because why not

---------

Signed-off-by: Jason Hall <[email protected]>
  • Loading branch information
imjasonh authored Jun 10, 2024
1 parent 5c395cf commit 60b1c76
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 29 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Test

on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
Expand All @@ -11,9 +14,13 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os:
- ubuntu-latest
- macos-latest
# - windows-latest TODO(jason): Enable when we install in the correct location.
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: ./
- run: chainctl version
34 changes: 6 additions & 28 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ runs:
arch="${{ runner.arch }}"
if [[ "${arch}" == "X64" ]]; then
arch="amd64"
if [[ "${os}" == "windows" ]]; then
arch="x86_64"
else
arch="amd64"
fi
elif [[ "${arch}" == "ARM64" ]]; then
arch="arm64"
fi
Expand All @@ -75,10 +79,7 @@ runs:
curl -o ./chainctl -fsL "${url}"
chmod +x ./chainctl
CHAINCTL_INSTALL_PATH="${HOME}/.local/bin"
mv ./chainctl "${CHAINCTL_INSTALL_PATH}"
# Ensure install directory is on the PATH for future steps
echo "${CHAINCTL_INSTALL_PATH}" >> "${GITHUB_PATH}"
mv ./chainctl /usr/local/bin
- name: Authenticate with Chainguard (assumed identity)
shell: bash
Expand Down Expand Up @@ -119,26 +120,3 @@ runs:
echo Failed to log in with invite code
exit 1
fi
- name: Authenticate with Chainguard (DEPRECATED registered identity)
shell: bash
if: ${{ inputs.identity == '' && inputs.invite-code == '' }}
env:
CHAINGUARD_INVITE_CODE: ${{ inputs.invite-code }}
CHAINCTL_DEBUG: "true"
run: |
echo "::warning::The use of registered Github actions identities is deprecated, use assumed identities instead."
AUDIENCE="${{ inputs.audience }}"
if [[ -z "${AUDIENCE}" ]]; then
AUDIENCE=issuer.${{ inputs.environment }}
fi
IDTOKEN=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=${AUDIENCE}" | jq -r '.value')
if chainctl auth login --identity-token "${IDTOKEN}" -v=${{ inputs.verbosity }}; then
echo Logged in!
else
echo No invite code is present! Failing since registration will not do any good.
echo Configure a secret named CHAINGUARD_INVITE_CODE to have this workload register itself.
exit 1
fi

0 comments on commit 60b1c76

Please sign in to comment.