forked from Open-IoT-Service-Platform/platform-launcher
-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (105 loc) · 3.72 KB
/
nightly.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
name: Nigthly
on:
schedule:
- cron: '0 0 * * *'
jobs:
test:
uses: Open-IoT-Service-Platform/platform-launcher/.github/workflows/makefile.yaml@develop
with:
UPGRADE_TEST: "true"
CURRENT_RELEASE_VERSION: ${{ secrets.CURRENT_RELEASE_VERSION }}
build:
needs: test
runs-on: ubuntu-20.04
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_PREFIX: ${{ secrets.DOCKER_PREFIX }}
PUSH_DRYRUN: ''
steps:
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 10
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
submodules: recursive
- name: Prepare Platform
shell: bash
run: |
export TERM=vt100
cd util && \
bash setup-ubuntu20.04.sh
- name: Setup and Build
shell: bash
run: |
export TERM=vt100
set +o pipefail
make update
yes | DOCKER_TAG=test NODOCKERLOGIN=true DEBUG=true make build
- name: Push images
shell: bash
run: |
export TERM=vt100
set +o pipefail
docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
# Tag passed "test" images as "latest"
images=$(docker images --format "{{.Repository}}:{{.Tag}}"| grep :test)
for image in $images; do
newimage=$(echo $image | sed -r "s/:test/:latest/g" | sed -r "s/$DOCKER_PREFIX/oisp/g");
docker tag $image $newimage;
done
#Start with latest tag, replace later by the real-tags
DOCKER_TAG="latest"
TARGET_DOCKER_TAG=nightly-`date -I`
DOCKER_PUSH_LATEST=true
# First push latest if applicable and then the real tag
echo Now trying to push with Tag ${DOCKER_TAG} push latest ${DOCKER_PUSH_LATEST}
if [ "$DOCKER_PUSH_LATEST" = "true" ]; then
echo Pushing images with latest tag
if [ -z "$PUSH_DRYRUN" ]; then
make push-images DOCKER_PREFIX=oisp
else
echo Only dry run mode. Not pushing to dockerhub!
fi
fi
# Now replace all latest tagged images by the real tag
echo Now pushing images with tag $DOCKER_TAG
images=$(docker images --format "{{.Repository}}:{{.Tag}}"| grep :latest | grep "oisp/")
for image in $images; do
newimage=$(echo $image | sed -r "s/:latest/:$TARGET_DOCKER_TAG/g");
echo tagging $image to $newimage;
docker tag $image $newimage
if [ -z "$PUSH_DRYRUN" ]; then
docker push ${newimage}
else
echo Only dry run mode. Not pushing to dockerhub!
fi
done
docker-action:
needs: build
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
NAMESPACE: ${{ secrets.NAMESPACE }}
runs-on: ubuntu-latest
container:
image: oisp/deployer:latest
credentials:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
steps:
- name: Deploy Test
run: |
export TERM=vt100
export HOME=/home/deployer
cd /home/deployer
export KUBECONFIG=/home/deployer/.kube/config
export HELM_ARGS="--atomic \
--set less_resources=\"false\" --set production=\"true\" \
--set certmanager.secret=\"frontend-web-prod-tls\" \
--set certmanager.issuer=\"letsencrypt-prod\" \
--set numberReplicas.frontend=2 \
--set numberReplicas.backend=3"
sh deploy.sh