Skip to content

Commit

Permalink
Merge pull request #7 from philiplee13/kind
Browse files Browse the repository at this point in the history
testing gh action
  • Loading branch information
philiplee13 authored Apr 7, 2024
2 parents b40cb8e + f336eea commit 76e8be7
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 5 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Integration tests
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
- "**" # every single branch
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: install tools
run: |
chmod +x ./scripts/install.sh
./scripts/install.sh
- name: apply resources and verify
run: |
chmod +x ./scripts/set-env-vars.sh
. ./scripts/set-env-vars.sh
echo $NAMESPACE
chmod +x ./scripts/verify.sh
./scripts/verify.sh
14 changes: 14 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh


set -e # exit on any error

echo "Installing k3s and kubectl"
curl -sfL https://get.k3s.io | sh -
sudo chmod -R a+rw /etc/rancher/k3s
sudo mkdir -p $HOME/.kube && sudo chown -R runner $HOME/.kube
sudo k3s kubectl config view --raw > $HOME/.kube/config
sudo chown runner $HOME/.kube/config
sudo chmod go-r $HOME/.kube/config
kubectl version

3 changes: 3 additions & 0 deletions scripts/set-env-vars.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

export NAMESPACE=dev-ns-set-in-env-vars
10 changes: 10 additions & 0 deletions scripts/verify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

set -e # exit on any error
cd tekton/kind/dev

kubectl get ns
kustomize build . | envsubst '$NAMESPACE' | kubectl apply -f-

kubectl get ns
kubectl get pods -n $NAMESPACE
2 changes: 1 addition & 1 deletion tekton/kind/dev/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: fast-api-deployment
namespace: dev-ns
namespace: $NAMESPACE
spec:
replicas: 1
selector:
Expand Down
2 changes: 1 addition & 1 deletion tekton/kind/dev/ns.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: dev-ns
name: $NAMESPACE
8 changes: 5 additions & 3 deletions tekton/kind/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: kind-test-run-updated
name: kind
spec:
pipelineSpec:
workspaces:
Expand All @@ -20,10 +20,12 @@ spec:
taskRef:
name: kind
params:
# so this might not work - k3s and kind both need docker to create clusters
# oob this doesn't seem like it works
- name: command
value: ["$(workspaces.source.path)/test.sh"]
value: ["ls -al $(workspaces.source.path)"]
- name: image
value: alpiner@sha256:bfe11e36d3d44ac89e5e9b39382c9b3638f5a3fedc3dc45b54ade8bb0248286d
value: gcr.io/tekton-releases/dogfooding/kind-runner@sha256:bfe11e36d3d44ac89e5e9b39382c9b3638f5a3fedc3dc45b54ade8bb0248286d
workspaces:
- name: source
workspace: workspace
Expand Down

0 comments on commit 76e8be7

Please sign in to comment.