GCP based k8s workflow
parent
1d52387294
commit
1075f4e168
|
|
@ -99,42 +99,19 @@ jobs:
|
||||||
version: '288.0.0'
|
version: '288.0.0'
|
||||||
service_account_email: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_EMAIL }}
|
service_account_email: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_EMAIL }}
|
||||||
service_account_key: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY }}
|
service_account_key: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY }}
|
||||||
- name: Testing
|
- name: Get Gist
|
||||||
|
id: get
|
||||||
|
uses: andymckay/get-gist-action@master
|
||||||
|
with:
|
||||||
|
gistURL: 'https://gist.github.com/frostebite/58fdeb02d45f6e7a24bcbe36f6bdc051'
|
||||||
|
- id: read-k8s-config
|
||||||
run: |
|
run: |
|
||||||
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
|
chmod +x ${{ steps.get.outputs.file }}
|
||||||
sudo install minikube-linux-amd64 /usr/local/bin/minikube
|
${{ steps.get.outputs.file }} ${{ env.GKE_PROJECT }} ${{ env.GKE_CLUSTER }} ${{ env.GKE_ZONE }}
|
||||||
minikube start
|
gcloud container clusters get-credentials $GKE_CLUSTER \
|
||||||
kubectl cluster-info
|
--zone $GKE_ZONE --project $GKE_PROJECT
|
||||||
kubectl get pods -n kube-system
|
# run a command to get access-token
|
||||||
cat <<EOF | kubectl apply -f -
|
kubectl version
|
||||||
apiVersion: v1
|
|
||||||
kind: PersistentVolume
|
|
||||||
metadata:
|
|
||||||
name: task-pv-volume
|
|
||||||
labels:
|
|
||||||
type: local
|
|
||||||
spec:
|
|
||||||
storageClassName: manual
|
|
||||||
capacity:
|
|
||||||
storage: 2Gi
|
|
||||||
accessModes:
|
|
||||||
- ReadWriteOnce
|
|
||||||
hostPath:
|
|
||||||
path: "/data/task-pv-volume"
|
|
||||||
EOF
|
|
||||||
cat <<EOF | kubectl apply -f -
|
|
||||||
apiVersion: v1
|
|
||||||
kind: PersistentVolumeClaim
|
|
||||||
metadata:
|
|
||||||
name: task-pv-claim
|
|
||||||
spec:
|
|
||||||
storageClassName: manual
|
|
||||||
accessModes:
|
|
||||||
- ReadWriteOnce
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: 2Gi
|
|
||||||
EOF
|
|
||||||
- uses: frostebite/File-To-Base64@master
|
- uses: frostebite/File-To-Base64@master
|
||||||
id: read-base64
|
id: read-base64
|
||||||
with:
|
with:
|
||||||
|
|
@ -149,11 +126,16 @@ jobs:
|
||||||
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
||||||
projectPath: test-project
|
projectPath: test-project
|
||||||
unityVersion: 2019.3.15f1
|
unityVersion: 2019.3.15f1
|
||||||
kubeVolume: task-pv-claim
|
- uses: frostebite/K8s-Download-Volume@master
|
||||||
- run: |
|
with:
|
||||||
ls /data/task-pv-volume
|
kubeConfig: ${{ steps.read-base64.outputs.base64 }}
|
||||||
|
volume: ${{ steps.k8s-unity-build.outputs.volume }}
|
||||||
|
sourcePath: repo/build/
|
||||||
- uses: actions/upload-artifact@v1
|
- uses: actions/upload-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: Kubernetes Build (${{ matrix.targetPlatform }})
|
name: Kubernetes Build (${{ matrix.targetPlatform }})
|
||||||
path: k8s-volume-download
|
path: k8s-volume-download
|
||||||
if: ${{ always() }}
|
- run: |
|
||||||
|
pods=$(kubectl get pods -o json | jq '.items | .[].metadata.labels' | jq 'select("app", "unity-builder")')
|
||||||
|
if [ -z pods ]; then gcloud container clusters delete ${{env.GKE_CLUSTER}} --zone $GKE_ZONE --project $GKE_PROJECT --quiet; fi
|
||||||
|
if: ${{ always() }}
|
||||||
Loading…
Reference in New Issue