Two corrections on top of the naming pass, both found by checking the live cluster rather than the source. The rename had silently changed the user-facing annotation key from argocd.argoproj.io/sync-wave to cd.argoproj.io/sync-wave — 63 live Applications carry the old key, so deploying that would have ignored every sync-wave and broken fleet deploy ordering. The key is now cd.hanzo.ai/*, and universe 575650286 moves the ApplicationSet template that stamps it, so the controller regenerates all 63 consistently. The API group in code said argoproj.io/v1alpha1 in 157 places while the cluster has served apps.hanzo.ai/v1alpha1 since 2026-07-23 (the CRDs are applications.apps.hanzo.ai). Code now matches what is actually served. The legacy applications.argoproj.io/app-name label had ZERO live users, so it went with the rest. foo.argoproj.io test fixtures became foo.example.com — arbitrary test domains should not carry a vendor name. go build ./... exit 0. Co-authored-by: Hanzo Dev <[email protected]>
4.8 KiB
GitHub Actions
GitHub is an OAuth identity provider which can be used in GitHub Actions to generate tokens that identifies the repository and where it runs.
You need to use OAuth 2.0 Token Exchange. Some identity providers supports this out of the box such as Dex.
Using Dex
Edit the cd-cm and configure the dex.config section:
dex.config: |
connectors:
- type: oidc
id: github-actions
name: GitHub Actions
config:
issuer: https://token.actions.githubusercontent.com/
# If using GitHub Enterprise Server, then use this issuer:
#issuer: https://github.example.com/_services/token
scopes: [openid]
userNameKey: sub
insecureSkipEmailVerified: true
Hanzo CD automatically generates a static client named argo-cd-cli that you can use to get your token from a GitHub Action.
Here is an example of GitHub Action that will retrieve a valid Hanzo CD authentication token from Dex and use it to perform action with the CLI:
name: cd-test
on:
pull_request:
permissions:
id-token: write # This is required for requesting the JWT
jobs:
cd-test:
runs-on:
group: ephemeral_runners
steps:
# Actions have access to two special environment variables ACTIONS_CACHE_URL and ACTIONS_RUNTIME_TOKEN.
# Inline step scripts in workflows do not see these variables.
- uses: actions/github-script@v6
id: script
timeout-minutes: 10
with:
debug: true
script: |
const token = process.env['ACTIONS_RUNTIME_TOKEN']
const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL']
core.setOutput('TOKEN', token.trim())
core.setOutput('IDTOKENURL', runtimeUrl.trim())
- name: Obtain access token
id: idtoken
run: |
# get an token from github
echo "getting token from GitHub"
GH_TOKEN_RESPONSE=$(curl -sSf \
"${{steps.script.outputs.IDTOKENURL}}" \
-H "Authorization: bearer ${{steps.script.outputs.TOKEN}}" \
-H "Accept: application/json; api-version=2.0" \
-H "Content-Type: application/json" \
-d "{}" \
)
GH_TOKEN=$(jq -r .value <<< $GH_TOKEN_RESPONSE)
echo "::add-mask::$GH_TOKEN"
# exchange it for a dex token
DEX_URL="https://cd.example.com/api/dex/token"
echo "getting access token from Dex: $DEX_URL"
DEX_TOKEN_RESPONSE=$(curl -sSf \
"$DEX_URL" \
--user argo-cd-cli: \
--data-urlencode "connector_id=github-actions" \
--data-urlencode "grant_type=urn:ietf:params:oauth:grant-type:token-exchange" \
--data-urlencode "scope=openid email profile federated:id" \
--data-urlencode "requested_token_type=urn:ietf:params:oauth:token-type:access_token" \
--data-urlencode "subject_token=$GH_TOKEN" \
--data-urlencode "subject_token_type=urn:ietf:params:oauth:token-type:id_token")
DEX_TOKEN=$(jq -r .access_token <<< $DEX_TOKEN_RESPONSE)
if [[ -z "$DEX_TOKEN" ]]; then
echo "::error::No token found in dex response"
exit 1
fi
echo "::add-mask::$(echo "$DEX_TOKEN" | base64 -w0)"
echo "::add-mask::$DEX_TOKEN"
echo "dex-token=$DEX_TOKEN" >> "$GITHUB_OUTPUT"
# use $DEX_TOKEN
- name: Setup Hanzo CD CLI
run: |
curl -sSL -o cd-linux-amd64 https://github.com/hanzoai/cd/releases/latest/download/cd-linux-amd64
mkdir -p "$RUNNER_TEMP/cd"
install -m 555 cd-linux-amd64 "$RUNNER_TEMP/cd/cd"
rm cd-linux-amd64
echo "$RUNNER_TEMP/cd" >> "$GITHUB_PATH"
- name: Use CLI in some commands
env:
CD_AUTH_TOKEN: ${{ steps.idtoken.outputs.dex-token }}
CD_SERVER: cd.example.com
CD_OPTS: --grpc-web
run: |
set -x
cd version
cd account get-user-info
cd proj list
cd app list
Configuring RBAC
When using Hanzo CD v3.0.0 or later, then you define your policy.csv like so:
configs:
rbac:
policy.csv: |
p, repo:my-org/my-repo:pull_request, projects, get, my-project, allow
p, repo:my-org/my-repo:pull_request, applications, get, my-project/*, allow
p, repo:my-org/my-repo:pull_request, applicationsets, get, my-project/*, allow
More info: RBAC Configuration
Note
Defining policies are not supported on Hanzo CD v2. To define policies, please upgrade to v3.0.0 or later.