Skip to content

Commit 4dfa19e

Browse files
committed
Ignore paths in workflow
1 parent 17062fd commit 4dfa19e

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/kubectl.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Run kubectl against remote cluster
2+
3+
on:
4+
workflow_dispatch: # Allows manual start of workflows
5+
push:
6+
branches:
7+
- "1-github-runner-manages-remote"
8+
paths-ignore:
9+
- *.md
10+
- *.example
11+
12+
jobs:
13+
deploy:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Install kubectl
17+
run: |
18+
mkdir $HOME/bin
19+
curl -Lf "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -o $HOME/bin/kubectl
20+
chmod +x $HOME/bin/kubectl
21+
echo "$HOME/bin" >> $GITHUB_PATH
22+
23+
- name: Check kubectl is available on PATH
24+
run: kubectl version --client
25+
26+
- name: Checkout repo
27+
uses: actions/checkout@v4
28+
29+
- name: Set kubeconfig with kubectl
30+
run: |
31+
kubectl config set-cluster "${{ vars.KUBE_REMOTE_CLUSTER }}" --server "${{ secrets.KUBE_API_SERVER_ADDR }}"
32+
kubectl config set-credentials "${{ vars.KUBE_REMOTE_USER }}" --token "${{ secrets.KUBE_JWT_AUTH_TOKEN }}"
33+
kubectl config set-context "${{ vars.KUBE_REMOTE_CONTEXT }}" --cluster "${{ vars.KUBE_REMOTE_CLUSTER }}" --user "${{ vars.KUBE_REMOTE_USER }}"
34+
kubectl config use-context "${{ vars.KUBE_REMOTE_CONTEXT }}"
35+
36+
- name: Run kubectl command against remote API
37+
run: kubectl get namespaces
38+
39+
- name: kubectl apply with a file
40+
run: kubectl apply -f "${GITHUB_WORKSPACE}/manifests/nginx-test.yml"

0 commit comments

Comments
 (0)