Skip to content

Commit

Permalink
Add restart workflow (#1513)
Browse files Browse the repository at this point in the history
* Add workflow

* fix workflows
  • Loading branch information
joryirving authored Jan 24, 2024
1 parent 35f3856 commit a4c00d9
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/bulk-merge-prs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: "$BOT_APP_ID"
private-key: "$BOT_APP_PRIVATE_KEY"
app-id: "${{ env.BOT_APP_ID }}"
private-key: "${{ env.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@v4
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/flux-diff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: "$BOT_APP_ID"
private-key: "$BOT_APP_PRIVATE_KEY"
app-id: "${{ env.BOT_APP_ID }}"
private-key: "${{ env.BOT_APP_PRIVATE_KEY }}"

- name: Checkout Default Branch
uses: actions/checkout@v4
Expand Down Expand Up @@ -69,8 +69,8 @@ jobs:
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: "$BOT_APP_ID"
private-key: "$BOT_APP_PRIVATE_KEY"
app-id: "${{ env.BOT_APP_ID }}"
private-key: "${{ env.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/flux-hr-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: "$BOT_APP_ID"
private-key: "$BOT_APP_PRIVATE_KEY"
app-id: "${{ env.BOT_APP_ID }}"
private-key: "${{ env.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@v4
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/flux-image-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: "$BOT_APP_ID"
private-key: "$BOT_APP_PRIVATE_KEY"
app-id: "${{ env.BOT_APP_ID }}"
private-key: "${{ env.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -70,8 +70,8 @@ jobs:
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: "$BOT_APP_ID"
private-key: "$BOT_APP_PRIVATE_KEY"
app-id: "${{ env.BOT_APP_ID }}"
private-key: "${{ env.BOT_APP_PRIVATE_KEY }}"

- name: Setup Homebrew
uses: Homebrew/actions/setup-homebrew@master
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/flux-ks-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: "$BOT_APP_ID"
private-key: "$BOT_APP_PRIVATE_KEY"
app-id: "${{ env.BOT_APP_ID }}"
private-key: "${{ env.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/label-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: "$BOT_APP_ID"
private-key: "$BOT_APP_PRIVATE_KEY"
app-id: "${{ env.BOT_APP_ID }}"
private-key: "${{ env.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/labeler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: "$BOT_APP_ID"
private-key: "$BOT_APP_PRIVATE_KEY"
app-id: "${{ env.BOT_APP_ID }}"
private-key: "${{ env.BOT_APP_PRIVATE_KEY }}"

- name: Labeler
uses: actions/labeler@v5
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/nas-restart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: "Deployment Restart"

on:
workflow_dispatch:

jobs:
sync:
name: Deployment Restart
runs-on: ["arc-runner-set-home-ops"]
strategy:
matrix:
cluster: ["teyvat"]
steps:
- name: Get Secrets
uses: bitwarden/sm-action@v2
with:
access_token: ${{ secrets.BW_ACCESS_TOKEN }}
secrets: |
1c493889-1e30-4156-a937-b10100433300 > KUBECONFIG
e062dcb9-8cd7-471e-b9be-b10100497102 > BOT_APP_ID
5856238d-3fae-4a0f-9847-b1010049f697 > BOT_APP_PRIVATE_KEY
- name: Generate Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: "${{ env.BOT_APP_ID }}"
private-key: "${{ env.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@v4
with:
token: "${{ steps.app-token.outputs.token }}"

- name: Setup Homebrew
uses: Homebrew/actions/setup-homebrew@master

- name: Setup Workflow Tools
shell: bash
run: brew install kubernetes-cli

- name: Write kubeconfig
id: kubeconfig
uses: timheuer/base64-to-file@v1
with:
encodedString: "$KUBECONFIG"
fileName: kubeconfig

- name: Restart NFS Deployments
env:
KUBECONFIG: "${{ steps.kubeconfig.outputs.filePath }}"
shell: bash
run: |
kubectl \
--context "${{ matrix.cluster }}" \
get deployments \
--all-namespaces \
-l nfsMount=true \
-o custom-columns="NAMESPACE:.metadata.namespace,NAME:.metadata.name" \
--no-headers | \
awk '{print "kubectl --context ${{ matrix.cluster }} rollout restart deployment/"$2" -n "$1}' | \
sh
4 changes: 2 additions & 2 deletions .github/workflows/publish-terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: "$BOT_APP_ID"
private-key: "$BOT_APP_PRIVATE_KEY"
app-id: "${{ env.BOT_APP_ID }}"
private-key: "${{ env.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: "$BOT_APP_ID"
private-key: "$BOT_APP_PRIVATE_KEY"
app-id: "${{ env.BOT_APP_ID }}"
private-key: "${{ env.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@v4
Expand Down

0 comments on commit a4c00d9

Please sign in to comment.