-
Notifications
You must be signed in to change notification settings - Fork 1
119 lines (105 loc) · 3.72 KB
/
main-ee.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: GraalVM Jibber Github Actions Pipeline (EE)
on: [push, pull_request]
jobs:
build:
name: GraalVM Jibber on ${{ matrix.os }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: graalvm/setup-graalvm@v1
with:
version: 'latest'
gds-token: ${{ secrets.GDS_TOKEN }}
java-version: '17'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Test Java Code
run: |
./mvnw --no-transfer-progress -Pnative -DskipNativeTests package
./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout > version.txt
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: |
version.txt
target/jibber
Dockerfiles/Dockerfile.native
retention-days: 1
push_container:
name: Push Container to OCIR
needs: [build]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
env:
OCI_CLI_USER: ${{ secrets.OCI_USER_OCID }}
OCI_CLI_TENANCY: ${{ secrets.OCI_TENANCY_OCID }}
OCI_CLI_FINGERPRINT: ${{ secrets.OCI_FINGERPRINT }}
OCI_CLI_KEY_CONTENT: ${{ secrets.OCI_KEY_FILE }}
OCI_CLI_REGION: ${{ secrets.OCI_REGION }}
OCI_CLI_COMPARTMENT: ${{ secrets.OCI_COMPARTMENT_OCID }}
steps:
- name: Get or create an OCIR Repository
uses: oracle-actions/[email protected]
id: get-ocir-repository
with:
name: demo
compartment: ${{ secrets.OCI_COMPARTMENT_OCID }}
- name: Log into OCIR
uses: oracle-actions/[email protected]
id: login-ocir
with:
auth_token: ${{ secrets.OCI_AUTH_TOKEN }}
- name: Download a single artifact
uses: actions/download-artifact@v3
with:
name: dist
- name: Tag and push a container image
id: tag-and-push-image
run: |
export VER=`cat version.txt`
echo ${VER}
#echo "${{ steps.get-ocir-repository.outputs.repo_path }}:jibber_new.native.latest" > repo_path.txt
export REPO="${{ steps.get-ocir-repository.outputs.repo_path }}:jibber_new.native.${VER}.NEW"
echo ${REPO}
echo ${REPO} > repo_path.txt
docker pull oraclelinux:8-slim
docker build -t ${REPO} -f Dockerfiles/Dockerfile.native --build-arg APP_FILE=target/jibber .
docker push "${REPO}"
- name: Archive repo path
uses: actions/upload-artifact@v3
with:
name: repo_path
path: |
repo_path.txt
retention-days: 1
install-kubectl:
runs-on: ubuntu-latest
name: Install Kubectl for OKE
needs: [push_container]
if: github.ref == 'refs/heads/main'
env:
OCI_CLI_USER: ${{ secrets.OCI_USER_OCID }}
OCI_CLI_TENANCY: ${{ secrets.OCI_TENANCY_OCID }}
OCI_CLI_FINGERPRINT: ${{ secrets.OCI_FINGERPRINT }}
OCI_CLI_KEY_CONTENT: ${{ secrets.OCI_KEY_FILE }}
OCI_CLI_REGION: ${{ secrets.OCI_REGION }}
steps:
- uses: actions/checkout@v3
- name: Download a single artifact
uses: actions/download-artifact@v3
with:
name: repo_path
- name: Configure Kubectl
uses: oracle-actions/[email protected]
id: test-configure-kubectl-oke-action
with:
cluster: ${{ secrets.OKE_CLUSTER_OCID }}
- name: Run Kubectl
run: kubectl get nodes -A
- name: Apply k8s config
run: |
ls -la
export IMG=`cat repo_path.txt`
kubectl apply -f k8s/namespace.yaml
IMG=`cat repo_path.txt` && envsubst < k8s/deployment.yaml | kubectl apply -f -