Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 1aa1459

Browse files
committed
[PAM-4365] Setup CI/CD for Github Actions
1 parent 22f107a commit 1aa1459

File tree

6 files changed

+115
-56
lines changed

6 files changed

+115
-56
lines changed

.github/workflows/deploy-dev.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: build-deploy-dev
2+
on:
3+
push:
4+
paths-ignore:
5+
- "**.md"
6+
- ".gitignore"
7+
- "LICENCE"
8+
- "CODEOWNERS"
9+
branches:
10+
- master
11+
jobs:
12+
build-and-deploy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v1
16+
- uses: actions/setup-java@v1
17+
with:
18+
java-version: '12.x'
19+
- uses: actions/cache@v1
20+
with:
21+
path: ~/.m2/repository
22+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
23+
restore-keys: |
24+
${{ runner.os }}-maven-
25+
- name: build and test
26+
run: mvn clean install
27+
- name: pre-deploy
28+
uses: navikt/pam-deploy/actions/pre-deploy@v1
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
- name: build and push docker image
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
run: |
35+
docker build . --pull -t $IMAGE
36+
echo "$GITHUB_TOKEN" | docker login --username "$GITHUB_REPOSITORY" --password-stdin docker.pkg.github.com
37+
docker push $IMAGE
38+
- name: deploy to dev-sbs
39+
uses: nais/deploy/actions/deploy@v1
40+
env:
41+
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
42+
CLUSTER: dev-sbs
43+
RESOURCE: naiserator.yml
44+
VARS: naiserator-dev.json
45+
- name: post-deploy
46+
uses: navikt/pam-deploy/actions/post-deploy@v1
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
- name: draft release
50+
uses: actions/create-release@latest
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
53+
with:
54+
tag_name: ${{ env.VERSION_TAG }}
55+
release_name: ${{ env.APPLICATION }} ${{ env.VERSION_TAG }}
56+
body: ${{ env.CHANGE_LOG }}
57+
draft: true
58+
prerelease: false

.github/workflows/deploy-prod.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: deploy-prod
2+
on:
3+
release:
4+
types: [published]
5+
6+
jobs:
7+
deploy-prod:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v1
11+
- name: get release tag
12+
env:
13+
VERSION_TAG: ${{ github.event.release.tag_name }}
14+
run: |
15+
APPLICATION=$(echo $GITHUB_REPOSITORY | cut -d "/" -f 2)
16+
IMAGE=docker.pkg.github.com/$GITHUB_REPOSITORY/$APPLICATION:$VERSION_TAG
17+
echo "::set-env name=IMAGE::$IMAGE"
18+
echo $IMAGE
19+
- uses: nais/deploy/actions/deploy@v1
20+
name: deploy to prod-sbs
21+
env:
22+
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
23+
CLUSTER: prod-sbs
24+
RESOURCE: naiserator.yml
25+
VARS: naiserator-prod.json
26+
- name: post-production
27+
uses: navikt/pam-deploy/actions/post-production@v1
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

nais-preprod.yaml

-40
This file was deleted.

naiserator-dev.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"ingress": ["https://pam-ontologi-indexer.nais.oera-q.local"],
3+
"pam_synonymer_typeahead_url": "https://api-gw-q0.oera.no/pam-ontologi-synonymer/rest/typeahead",
4+
"pam_es_url": "https://tpa-stilling-opendistro-elasticsearch.nais.oera-q.local"
5+
}

naiserator-prod.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"ingress": ["https://pam-ontologi-indexer.nais.oera.no"],
3+
"pam_synonymer_typeahead_url": "https://api-gw.oera.no/pam-ontologi-synonymer/rest/typeahead",
4+
"pam_es_url": "https://tpa-stilling-opendistro-elasticsearch.nais.oera.no"
5+
}

nais.yaml naiserator.yml

+18-16
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,37 @@ metadata:
66
labels:
77
team: teampam
88
spec:
9-
image: repo.adeo.no:5443/pam-ontologi-indexer
9+
image: {{ image }}
1010
port: 9023
11-
replicas:
12-
min: 1
13-
max: 1
14-
cpuThresholdPercentage: 50
15-
prometheus:
16-
enabled: true
17-
path: /internal/actuator/prometheus
1811
liveness:
19-
initialDelay: 180
2012
path: /internal/isAlive
13+
initialDelay: 30
2114
readiness:
22-
initialDelay: 180
2315
path: /internal/isReady
16+
initialDelay: 30
17+
replicas:
18+
min: 1
19+
max: 1
20+
cpuThresholdPercentage: 50
2421
resources:
2522
limits:
2623
cpu: 1000m
27-
memory: 1000Mi
24+
memory: 1024Mi
2825
requests:
2926
cpu: 500m
30-
memory: 500Mi
31-
webproxy: false
27+
memory: 512Mi
3228
vault:
3329
enabled: true
30+
webproxy: false
31+
prometheus:
32+
enabled: true
33+
path: /internal/actuator/prometheus
3434
ingresses:
35-
- https://pam-ontologi-indexer.nais.oera.no
35+
{{#each ingress as |url|}}
36+
- {{url}}
37+
{{/each}}
3638
env:
3739
- name: PAM_SYNONYMER_TYPEAHEAD_URL
38-
value: https://api-gw.oera.no/pam-ontologi-synonymer/rest/typeahead
40+
value: {{ pam_synonymer_typeahead_url }}
3941
- name: PAM_ES_URL
40-
value: https://tpa-stilling-opendistro-elasticsearch.nais.oera.no
42+
value: {{ pam_es_url }}

0 commit comments

Comments
 (0)