This repository has been archived by the owner on Jan 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
116 lines (110 loc) · 3.98 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
110
111
112
113
114
115
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"
secrets:
CURRENT_RELEASE_VERSION: ${{ secrets.CURRENT_RELEASE_VERSION }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
build:
needs: test
runs-on: private
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_PREFIX: ${{ secrets.DOCKER_PREFIX }}
PUSH_DRYRUN: ''
SELF_HOSTED_RUNNER: true
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Prepare Platform
shell: bash
run: |
export TERM=vt100
if [ -z "${SELF_HOSTED_RUNNER}" ]; then
cd util && \
bash setup-ubuntu20.04.sh
else
make recreate-registry
make restart-cluster
fi
- name: Setup and Build
shell: bash
run: |
export TERM=vt100
set +o pipefail
git submodule update --recursive --init
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 DEBUG=true
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: private
# 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