-
Notifications
You must be signed in to change notification settings - Fork 13
73 lines (66 loc) · 2.39 KB
/
preview-kubernetes.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Generate diff of Kubernetes changes
on:
pull_request:
branches:
- 'main'
paths:
- '.holo/config.toml'
- '.holo/sources/jarvus-cluster-template.toml'
- '.holo/branches/kubernetes-workspace/**'
- '.github/workflows/*-kubernetes.yml'
- 'ci/**'
- 'kubernetes/apps/**'
- 'kubernetes/system/**'
env:
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_TOKEN }}
jobs:
preview-kubernetes:
runs-on: ubuntu-latest
env:
CLOUDSDK_CORE_PROJECT: cal-itp-data-infra
GKE_NAME: data-infra-apps
GKE_REGION: us-west1
USE_GKE_GCLOUD_AUTH_PLUGIN: True
steps:
# Setup
- uses: actions/checkout@v4
- uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
- uses: google-github-actions/setup-gcloud@v2
- run: gcloud components install gke-gcloud-auth-plugin
- uses: google-github-actions/get-gke-credentials@v1
with:
cluster_name: ${{ env.GKE_NAME }}
location: ${{ env.GKE_REGION }}
- run: curl -sSL https://install.python-poetry.org | python -
- name: Set up hologit
env:
BIO_RELEASE: 1.6.821
run: |
curl -LO "https://github.com/biome-sh/biome/releases/download/v${BIO_RELEASE}/bio-${BIO_RELEASE}-x86_64-linux.tar.gz"
tar xzvf "bio-${BIO_RELEASE}-x86_64-linux.tar.gz"
sudo mv bio /usr/local/bin/bio
sudo bio pkg install --binlink jarvus/hologit
git config user.name "Github Action $GITHUB_JOB"
git config user.email "$(whoami)@$(uname -n)"
# Render Kubernetes content with parent underlay and checkout
- run: git holo project kubernetes-workspace --commit-to=kubernetes
- run: git checkout kubernetes
# Diff and write back to PR
- run: poetry install
working-directory: ci
- run: poetry run invoke diff -f "./kubernetes-workloads.yaml" --outfile=diff.md
working-directory: ci
- uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.number }}
comment-author: 'github-actions[bot]'
direction: last
- uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.number }}
body-file: "ci/diff.md"
edit-mode: replace