generated from oracle-devrel/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 56
/
command_spec.yaml
76 lines (75 loc) · 2.8 KB
/
command_spec.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
version: 0.1
component: command
timeoutInSeconds: 900
failImmediatelyOnError: true
shell: bash
steps:
- type: Command
name: "Install nodejs"
shell: bash
timeoutInSeconds: 3600
command: |
dnf module enable -y nodejs:16
dnf module install -y nodejs
- type: Command
name: "Git Clone"
shell: bash
timeoutInSeconds: 100
command: |
git clone ${github_repo_url}
- type: Command
name: "Setup kube config"
shell: bash
timeoutInSeconds: 100
command: |
oci ce cluster create-kubeconfig --cluster-id ${cluster} \
--file $HOME/.kube/config --region ${region} --token-version 2.0.0 \
--kube-endpoint PUBLIC_ENDPOINT
- type: Command
name: "Custom Kustomize with versions"
shell: bash
timeoutInSeconds: 300
command: |
cd /workspace/save-the-wildlife
adb_wallet_password="$(openssl rand -base64 12)_$RANDOM"
oci db autonomous-database generate-wallet --autonomous-database-id ${adb_id} --file "/workspace/save-the-wildlife/deploy/k8s/base/score/wallet.zip" --password "$adb_wallet_password"
- type: Command
name: "Custom Kustomize with versions"
shell: bash
timeoutInSeconds: 300
command: |
cd /workspace/save-the-wildlife
redis_password=$(oci secrets secret-bundle get --secret-id ${redis_password_id} --query 'data."secret-bundle-content".content' | tr -d '\"' | base64 -d)
adb_admin_password=$(oci secrets secret-bundle get --secret-id ${adb_admin_password_id} --query 'data."secret-bundle-content".content' | tr -d '\"' | base64 -d)
npx zx scripts/kustom.mjs ${region_key} $redis_password $adb_admin_password ${adb_service}
- type: Command
name: "Create OCIR Secret"
shell: bash
timeoutInSeconds: 300
command: |
user_auth_token=$(oci secrets secret-bundle get --secret-id ${user_auth_token_id} --query 'data."secret-bundle-content".content' | tr -d '\"' | base64 -d)
kubectl delete secret ocir-secret --ignore-not-found
kubectl create secret docker-registry ocir-secret \
--docker-server=${region_key}.ocir.io \
--docker-username="${oci_namespace}/${ocir_user}" \
--docker-password="$user_auth_token" \
--docker-email=${ocir_user}
- type: Command
name: "Apply kustomization"
shell: bash
timeoutInSeconds: 300
command: |
kubectl apply -k ./save-the-wildlife/deploy/k8s/overlays/devops
- type: Command
name: "Wait for Load Balancer (sleep)"
shell: bash
timeoutInSeconds: 100
command: |
sleep 60
- type: Command
name: "Get Load Balancer IP address"
shell: bash
timeoutInSeconds: 100
command: |
LB_PUBLIC_IP=$(kubectl get svc ingress-nginx-controller -n ingress-nginx --template="{{range .status.loadBalancer.ingress}}{{.ip}}{{end}}")
echo "http://$LB_PUBLIC_IP/"