convert bash to pulumi gha #90
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
# This GitHub Workflow will run on every push to the repository | |
# and will test the Kargo codebase on a Kind Kubernetes cluster. | |
name: CI - Kargo on Kind | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "devcontainer/**" | |
- ".devcontainer/**" | |
- ".pulumi/**" | |
- ".talos/**" | |
- ".kube/**" | |
- "docs/**" | |
- "**.md" | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- "devcontainer/**" | |
- ".devcontainer/**" | |
- ".pulumi/**" | |
- ".talos/**" | |
- ".kube/**" | |
- "docs/**" | |
- "**.md" | |
schedule: | |
- cron: "0 2 * * *" | |
jobs: | |
ci-kargo-kind: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
id: checkout | |
with: | |
fetch-depth: 1 | |
- uses: pulumi/actions@v5 | |
id: pulumi-install | |
- name: Kubernetes KinD Cluster | |
uses: helm/[email protected] | |
with: | |
wait: 30s | |
cluster_name: kargo | |
config: hack/kind.yaml | |
ignore_failed_clean: true | |
- name: Kubectl Get Pods | |
id: kubectl-get-pods | |
env: | |
KUBECONFIG: .kube/config | |
ACTIONS_STEP_DEBUG: true | |
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
set -x | |
sudo kind get kubeconfig --name kargo > .kube/config | |
kubectl cluster-info --context kind-kargo | |
kubectl get po --all-namespaces --context kind-kargo | |
- name: Create Kind Cluster | |
id: create-kind-kubernetes | |
env: | |
KUBECONFIG: .kube/config | |
ACTIONS_STEP_DEBUG: true | |
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
set -x | |
source .envrc | |
kubectl config get-contexts | |
kubectl cluster-info --context kind-kargo | |
- uses: pulumi/actions@v5 | |
id: pulumi-up | |
with: | |
command: up | |
work-dir: ./ | |
cloud-url: file://$GITHUB_WORKSPACE/.pulumi | |
refresh: true | |
secrets-provider: passphrase | |
stack-name: ci | |
# - id: pulumi-up | |
# name: Deploy Pulumi IaC | |
# env: | |
# KUBECONFIG: .kube/config | |
# ACTIONS_STEP_DEBUG: true | |
# PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# run: | | |
# source .envrc | |
# pulumi login | |
# pulumi install | |
# pulumi stack select --create dev | |
# pulumi config set kubernetes kind | |
# pulumi up --refresh --skip-preview | |
- id: pulumi-destroy | |
name: Wait for Kind Kubernetes API to be Ready | |
env: | |
KUBECONFIG: .kube/config | |
ACTIONS_STEP_DEBUG: false | |
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
source .envrc | |
pulumi down --skip-preview --refresh \ | |
|| PULUMI_K8S_DELETE_UNREACHABLE=true pulumi down --skip-preview --refresh | |
# - name: Cleanup | |
# id: clean-all | |
# if: always() | |
# run: | | |
# make clean-all | |
# env: | |
# KUBECONFIG: /tmp/kubeconfig | |
# ACTIONS_STEP_DEBUG: false | |
# PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |