Update workflows

This commit is contained in:
Haitao Pan 2026-01-02 11:10:06 +08:00
parent eaf3d0d8a8
commit c3dcbd5a71
5 changed files with 44 additions and 10 deletions

View File

@ -54,9 +54,20 @@ jobs:
id: gitops_repo id: gitops_repo
shell: bash shell: bash
run: | run: |
repo_input="${{ github.event.inputs.gitops_repo_name || 'https://github.com/cloud-neutral-workshop/gitops.git' }}" repo_input="${{ github.event.inputs.gitops_repo_name }}"
repo="${repo_input#https://github.com/}" if [ -z "$repo_input" ]; then
repo_input="https://github.com/cloud-neutral-workshop/gitops.git"
fi
case "$repo_input" in
https://github.com/*) repo="${repo_input#https://github.com/}" ;;
git@github.com:*) repo="${repo_input#git@github.com:}" ;;
*) repo="$repo_input" ;;
esac
repo="${repo%.git}" repo="${repo%.git}"
if [ -z "$repo" ]; then
echo "GitOps repo is empty after normalization." >&2
exit 1
fi
echo "repo=$repo" >> "$GITHUB_OUTPUT" echo "repo=$repo" >> "$GITHUB_OUTPUT"
- name: Checkout GitOps config - name: Checkout GitOps config

View File

@ -35,11 +35,11 @@ on:
env: env:
TG_VERSION: 0.67.14 TG_VERSION: 0.67.14
TG_ROOT: ${{ github.event.inputs.bootstrap_cloud }} TG_ROOT: ${{ github.event.inputs.bootstrap_cloud || 'terraform-hcl-standard/aws-cloud/bootstrap' }}
GITOPS_REPO: ${{ github.event.inputs.gitops_repo_name }} GITOPS_REPO: ${{ github.event.inputs.gitops_repo_name || 'https://github.com/cloud-neutral-workshop/gitops.git' }}
DEPLOY_ACTION: ${{ github.event.inputs.deploy_action || 'plan' }} DEPLOY_ACTION: ${{ github.event.inputs.deploy_action || 'plan' }}
BOOTSTRAP_CONFIG_FILE: ${{ github.event.inputs.gitops_bootstrap_config }} BOOTSTRAP_CONFIG_FILE: ${{ github.event.inputs.gitops_bootstrap_config || 'config/xzerolab/sit/aws-cloud/account/bootstrap.yaml' }}
BOOTSTRAP_CONFIG_PATH: terraform-hcl-standard/aws-cloud/bootstrap/gitops/${{ github.event.inputs.gitops_bootstrap_config }} BOOTSTRAP_CONFIG_PATH: terraform-hcl-standard/aws-cloud/bootstrap/gitops/${{ github.event.inputs.gitops_bootstrap_config || 'config/xzerolab/sit/aws-cloud/account/bootstrap.yaml' }}
jobs: jobs:
bootstrap: bootstrap:

View File

@ -50,9 +50,20 @@ jobs:
id: gitops_repo id: gitops_repo
shell: bash shell: bash
run: | run: |
repo_input="${{ github.event.inputs.gitops_repo_name || 'https://github.com/cloud-neutral-workshop/gitops.git' }}" repo_input="${{ github.event.inputs.gitops_repo_name }}"
repo="${repo_input#https://github.com/}" if [ -z "$repo_input" ]; then
repo_input="https://github.com/cloud-neutral-workshop/gitops.git"
fi
case "$repo_input" in
https://github.com/*) repo="${repo_input#https://github.com/}" ;;
git@github.com:*) repo="${repo_input#git@github.com:}" ;;
*) repo="$repo_input" ;;
esac
repo="${repo%.git}" repo="${repo%.git}"
if [ -z "$repo" ]; then
echo "GitOps repo is empty after normalization." >&2
exit 1
fi
echo "repo=$repo" >> "$GITHUB_OUTPUT" echo "repo=$repo" >> "$GITHUB_OUTPUT"
- name: Checkout GitOps config - name: Checkout GitOps config

View File

@ -52,9 +52,20 @@ jobs:
id: gitops_repo id: gitops_repo
shell: bash shell: bash
run: | run: |
repo_input="${{ github.event.inputs.gitops_repo_name || 'https://github.com/cloud-neutral-workshop/gitops.git' }}" repo_input="${{ github.event.inputs.gitops_repo_name }}"
repo="${repo_input#https://github.com/}" if [ -z "$repo_input" ]; then
repo_input="https://github.com/cloud-neutral-workshop/gitops.git"
fi
case "$repo_input" in
https://github.com/*) repo="${repo_input#https://github.com/}" ;;
git@github.com:*) repo="${repo_input#git@github.com:}" ;;
*) repo="$repo_input" ;;
esac
repo="${repo%.git}" repo="${repo%.git}"
if [ -z "$repo" ]; then
echo "GitOps repo is empty after normalization." >&2
exit 1
fi
echo "repo=$repo" >> "$GITHUB_OUTPUT" echo "repo=$repo" >> "$GITHUB_OUTPUT"
- name: Checkout GitOps config - name: Checkout GitOps config

1
.gitignore vendored
View File

@ -54,3 +54,4 @@ hosts/inventory
offline-iac/ offline-iac/
offline-setup-*.tar.gz offline-setup-*.tar.gz
.env