Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: trigger-jenkins-deployment | ||
on: | ||
workflow_call: | ||
inputs: | ||
connect_to_tailnet: | ||
type: string | ||
required: false | ||
description: "Does workflow needs to connect to tailnet before triggering job?" | ||
default: "true" | ||
role_name: | ||
type: string | ||
required: false | ||
region: | ||
type: string | ||
default: "eu-west-2" | ||
required: false | ||
description: "AWS region" | ||
secret_name: | ||
type: string | ||
required: false | ||
tailscale_client_version: | ||
type: string | ||
default: "1.66.3" | ||
required: false | ||
description: "Tailscale client version." | ||
application_name: | ||
type: string | ||
default: "radquest" | ||
aws_eks_cluster: | ||
default: "rdx-works-main-dev" | ||
type: string | ||
aws_iam_role_name: | ||
default: "jenkins-radquest-pr-deployer" | ||
required: true | ||
type: string | ||
helm_dir: | ||
default: "deploy/helm" | ||
type: string | ||
image_tag: | ||
default: "develop-12345" | ||
type: string | ||
secrets: | ||
secrets_account_id: | ||
description: 'AWS secrets account ID.' | ||
required: true | ||
jobs: | ||
connect-to-tailnet: | ||
if: ${{ inputs.connect_to_tailnet == 'true' }} | ||
name: "Connect to Tailscale" | ||
permissions: | ||
id-token: write | ||
contents: read | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Fetch Tailscale secrets" | ||
uses: radixdlt/public-iac-resuable-artifacts/fetch-secrets@main | ||
with: | ||
role_name: 'arn:aws:iam::${{ secrets.secrets_account_id }}:role/gh-common-secrets-read-access' | ||
app_name: "tailnet-connect" | ||
step_name: setup-tailnet | ||
secret_prefix: "TAILSCALE" | ||
region: ${{ inputs.region }} | ||
secret_name: 'arn:aws:secretsmanager:eu-west-2:${{ secrets.secrets_account_id }}:secret:github-actions/common/tailscale-public-workflows-DpiE80' | ||
parse_json: true | ||
- name: "Connect to Tailnet" | ||
uses: RDXWorks-actions/github-action@main | ||
with: | ||
authkey: ${{ env.TAILSCALE_AUTHKEY }} | ||
version: ${{ inputs.tailscale_client_version }} | ||
trigger-jenkins-job: | ||
if: ${{ inputs.connect_to_tailnet == 'true' }} | ||
name: "Trigger Jenkins job." | ||
permissions: | ||
id-token: write | ||
contents: read | ||
- uses: radixdlt/public-iac-resuable-artifacts/fetch-secrets@main | ||
with: | ||
role_name: 'arn:aws:iam::${{ secrets.secrets_account_id }}:role/gh-common-secrets-read-access' | ||
app_name: 'radquest' | ||
step_name: 'deploy-pr' | ||
secret_prefix: 'GH' | ||
secret_name: 'arn:aws:secretsmanager:eu-west-2:${{ secrets.secrets_account_id }}:secret:github-actions/common/jenkins-credentials-RTHKoO' | ||
parse_json: true | ||
- name: Trigger jenkins job to deploy PR | ||
uses: RDXWorks-actions/jenkins-job-trigger-action@master | ||
with: | ||
jenkins_url: "https://jenkins-internal.extratools.works/" | ||
jenkins_user: ${{ env.GH_JENKINS_USER }} | ||
jenkins_token: ${{ env.GH_JENKINS_API_TOKEN }} | ||
job_name: "kubernetes-deployments/job/radquest" | ||
job_params: | | ||
{ | ||
"git_repo" : "${{ github.repository }}", | ||
"git_branch" : "${{ github.head_ref }}", | ||
"helmfile_environment": "pr", | ||
"hierarchical_namespace": "radquest-ci-pr", | ||
"namespace" : "radquest-pr-${{ github.event.number }}", | ||
"create_subnamespace" : "true", | ||
"aws_region" : "${{ inputs.aws_region }}", | ||
"aws_iam_role": "arn:aws:iam::${{ secrets.secrets_account_id }}:role/${{ inputs.aws_iam_role_name }}", | ||
"aws_eks_cluster" : "${{ inputs.aws_eks_cluster }}", | ||
"helm_folder" : "${{ inputs.helm_dir }}", | ||
"helmfile_extra_vars" : "ci.tag=${{ inputs.image_tag }},ci.prNumber=${{ github.event.number }},ci.aws_account_number=${{ secrets.secrets_account_id }}" | ||
} | ||
job_timeout: '3600' | ||
fetch_logs: 'false' | ||
# - name: Further debug | ||
# run: | | ||
# #!/bin/bash -ex | ||
# telnet jenkins-internal.extratools.works 443 | ||
- name: Write PR URL to GH summary | ||
if: ${{ github.event.pull_request }} | ||
run: | | ||
echo "PR URL is: https://${{ inputs.application_name }}-pr-${{ github.event.number }}.rdx-works-main.extratools.works" >> $GITHUB_STEP_SUMMARY |