Questo contenuto non è disponibile nella lingua selezionata.
Chapter 1. Adding secrets and variables to GitHub Actions for integration with external tools
Prerequisites
Before you configure GitHub Actions, ensure you have the following:
- Admin access to your GitHub repository and CI/CD settings.
- Container registry credentials for pulling container images from Quay.io, JFrog Artifactory, or Sonatype Nexus.
Authentication details for specific GitHub Actions tasks:
For ACS security tasks:
- ROX Central server endpoint
- ROX API token
For SBOM and artifact signing tasks:
- Cosign signing key password, private key and public key
- Trustification API and issuer URL, client ID, client secret, and supported CycloneDX version
NoteThe credentials and other details are already Base64-encoded, so you do not need to encode them again. You can find these credentials in your
private.env
file, which you created during RHTAP installation.
1.1. Option 1: Adding secrets and variables to GitHub Actions using UI Copia collegamentoCollegamento copiato negli appunti!
Procedure
- Log in to GitHub and navigate to your source repository.
- Go to the Settings tab.
- In the left navigation pane, select Secrets and variables, then select Actions.
On the Actions secrets and variables page select the Secrets tab.
- Select New repository secret.
- In the Name field, enter MY_GITHUB_TOKEN.
- In the Secret field, enter the token associated with your GitHub account.
- Select Add secret.
Repeat step 4 to add the required secrets:
Expand Table 1.1. Image registry and GitOps secrets Variable Description IMAGE_REGISTRY_PASSWORD
Password for accessing your container image registry.
GITOPS_AUTH_PASSWORD
The token the system uses to update the GitOps repository for newly built images.
Expand Table 1.2. Secrets required for ACS and SBOM tasks Variable Description ROX_API_TOKEN
API token for accessing the ROX server.
COSIGN_SECRET_PASSWORD
Password for Cosign signing key.
COSIGN_SECRET_KEY
Private key for Cosign.
TRUSTIFICATION_OIDC_CLIENT_SECRET
Client secret used alongside the client ID to authenticate to the Trustification Bombastic API.
On the Actions secrets and variables page switch to the Variables tab.
- Select New repository variable.
- In the Name field, enter IMAGE_REGISTRY_USER.
- In the Value field, enter the username for accessing your container image registry.
- Select Add variable.
Repeat step 6 to add the required variables:
Expand Table 1.3. Image registry variable Variable Description IMAGE_REGISTRY_USER
Username for accessing your container image registry.
Expand Table 1.4. Variables required for ACS and SBOM tasks Variable Description ROX_CENTRAL_ENDPOINT
Endpoint for the ROX Central server.
COSIGN_PUBLIC_KEY
Public key for Cosign.
TRUSTIFICATION_BOMBASTIC_API_URL
URL for Trustification Bombastic API used in SBOM generation.
TRUSTIFICATION_OIDC_ISSUER_URL
OIDC issuer URL used for authentication when interacting with the Trustification Bombastic API.
TRUSTIFICATION_OIDC_CLIENT_ID
Client ID for authenticating to the Trustification Bombastic API using OIDC.
TRUSTIFICATION_SUPPORTED_CYCLONEDX_VERSION
Specifies the CycloneDX SBOM version that is supported and generated by the system.
Optional: Set the Rekor and TUF variables if your CI provider runners do not run on the same cluster as the RHTAP instance.
Expand Table 1.5. Rekor and TUF variables Variable Description REKOR_HOST
URL of your Rekor server.
TUF_MIRROR
URL of your TUF service.
Rerun the last pipeline run to verify the secrets are applied correctly.
- Alternatively, switch to you application’s source repository in GitHub, make a minor change, and commit it to trigger a new pipeline run.
1.2. Option 2: Adding secrets and variables to GitHub Actions using CLI Copia collegamentoCollegamento copiato negli appunti!
Procedure
Create a project with two files in your preferred text editor, such as Visual Studio Code:
- env_vars.sh
- ghub-set-vars
Update the
env_vars.sh
file with the following environment variables:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Update the
ghub-set-vars
file with the following information:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Load the environment variables into your current shell session:
source env_vars.sh
source env_vars.sh
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Make the
ghub-set-vars
script executable, and run it with your repository name to set the variables in your GitHub repository.chmod +x ghub-set-vars ./ghub-set-vars your_repository_name
chmod +x ghub-set-vars ./ghub-set-vars your_repository_name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Rerun the last pipeline run to verify the secrets are applied correctly.
- Alternatively, switch to you application’s source repository in GitHub, make a minor change, and commit it to trigger a new pipeline run.
Revised on 2025-04-30 03:55:48 UTC