Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Nigthly

Nigthly #597

Workflow file for this run

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