Skip to content

Instantly share code, notes, and snippets.

# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request:
- name: 'Deploy the API on OKE'
run: |
kubectl delete deployment $DEPLOYMENT_NAME
kubectl create deployment $DEPLOYMENT_NAME --image=$IMAGE_NAME --dry-run -o yaml > deployment.yaml
kubectl apply -f deployment.yaml
kubectl rollout status deployment/$DEPLOYMENT_NAME
kubectl create service loadbalancer $DEPLOYMENT_NAME --tcp=80:$PORT --dry-run -o yaml > service.yaml
kubectl apply -f service.yaml
kubectl get services -o wide
- name: 'Download the KUBECONFIG'
run: |
mkdir -p ~/.kube
oci ce cluster create-kubeconfig --cluster-id ${{ secrets.OKE_OCID }} --file ~/.kube/config --region ${{secrets.OCI_REGION}} --token-version 2.0.0
export KUBECONFIG=~/.kube/config
- name: 'Fix Config File Permissions'
run: |
oci setup repair-file-permissions --file /home/runner/.oci/config
oci setup repair-file-permissions --file /home/runner/.oci/key.pem
- name: 'Install OCI CLI'
run: |
curl -L -O https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh
chmod +x install.sh
./install.sh --accept-all-defaults
echo "::add-path::/home/runner/bin"
exec -l $SHELL
- name: 'Write Config & Key Files'
run: |
mkdir ~/.oci
echo "[DEFAULT]" >> ~/.oci/config
echo "user=${{secrets.OCI_USER_OCID}}" >> ~/.oci/config
echo "fingerprint=${{secrets.OCI_FINGERPRINT}}" >> ~/.oci/config
echo "region=${{secrets.OCI_REGION}}" >> ~/.oci/config
echo "tenancy=${{secrets.OCI_TENANCY_OCID}}" >> ~/.oci/config
echo "key_file=~/.oci/key.pem" >> ~/.oci/config
echo "${{secrets.OCI_KEY_FILE}}" >> ~/.oci/key.pem
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
ShipaPool: oke
Resources:
General:
Setup:
Default: false
Public: false
Provisioner: kubernetes
Force: false
KubeNamespace: ""
Plan:
{
"display-name": "ListInstanceDeployment",
"gateway-id": "ocid1.apigateway.oc1.iad.amaaaaaa.....",
"path-prefix": "/v1",
"specification": {
"logging-policies": {
"access-log": {
"is-enabled": true
},
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: kubernetes-dashboard
labels:
k8s-app: kubernetes-dashboard
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole