Skip to content

fix scale

fix scale #58

Workflow file for this run

name: '[docker image]'
on:
push:
branches:
- master
- mvp_nehubaUpdated
- staging
# do not rebuild if...
paths-ignore:
# use_docs (use_docs are built on readthedocs any way)
- 'use_docs/*'
env:
OKD_URL: https://okd.hbp.eu:443
jobs:
build-docker-img:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 'Setup envvar'
run: |
if [[ $GITHUB_REF == 'refs/heads/master' ]]; then
echo "DOCKERIMG=voluba:latest" >> "$GITHUB_ENV"
fi
if [[ $GITHUB_REF == 'refs/heads/staging' ]]; then
echo "DOCKERIMG=voluba:staging" >> "$GITHUB_ENV"
fi
if [[ $GITHUB_REF == 'refs/heads/mvp_nehubaUpdated' ]]; then
echo "DOCKERIMG=voluba:mvp_nehubaUpdated" >> "$GITHUB_ENV"
fi
- name: 'Setup tags'
run: |
if [[ -z "$DOCKERIMG" ]]
then
echo "DOCKERIMG not set!"
exit 1
fi
DOCKER_IMGSTREAM=${{ secrets.EBRAINS_DOCKER_REG_VOLUBA_NSP }}/${DOCKERIMG}
echo "Setting docker image stream to $DOCKER_IMGSTREAM"
echo "DOCKER_IMGSTREAM=$DOCKER_IMGSTREAM" >> $GITHUB_ENV
- name: 'Set matomo env var'
run: |
echo "MATOMO_URL=${{ secrets.MATOMO_URL_PROD }}" >> $GITHUB_ENV
echo "MATOMO_ID=${{ secrets.MATOMO_ID_PROD }}" >> $GITHUB_ENV
- name: 'Set version variable & expmt feature flag'
run: |
GIT_HASH=$(git rev-parse --short HEAD)
echo "Setting GIT_HASH: $GIT_HASH"
echo "GIT_HASH=$GIT_HASH" >> $GITHUB_ENV
# VERSION=$(jq -r '.version' package.json)
# echo "Setting VERSION: $VERSION"
# echo "VERSION=$VERSION" >> $GITHUB_ENV
# VUE_APP_ENABLE_EXPERIMENTAL_FEATURES="{}"
- name: 'Build docker image'
run: |
echo "Building $DOCKER_IMGSTREAM"
docker build \
--build-arg MATOMO_URL=$MATOMO_URL \
--build-arg MATOMO_ID=$MATOMO_ID \
--build-arg VUE_APP_BACKEND_URL=${{ secrets.VUE_APP_BACKEND_URL }} \
--build-arg VUE_APP_UPLOAD_URL=${{ secrets.VUE_APP_UPLOAD_URL }} \
-t $DOCKER_IMGSTREAM \
.
echo "Successfully built $DOCKER_IMGSTREAM"
- name: 'Push to docker registry'
run: |
echo "Login to docker registry"
docker login \
-u '${{ secrets.EBRAINS_DOCKER_REG_USER }}' \
-p '${{ secrets.EBRAINS_DOCKER_REG_TOKEN }}' \
docker-registry.ebrains.eu
echo "Pushing $DOCKER_IMGSTREAM"
docker push $DOCKER_IMGSTREAM
deploy-on-okd:
needs: [ build-docker-img ]
if: success()
runs-on: ubuntu-latest
steps:
- name: "Configure image stream"
run: |
if [[ "$GITHUB_REF" == "refs/heads/master" ]]
then
echo "IMAGE_STREAM_TAG=docker-registry.default.svc:5000/voluba/voluba-img-deploy:latest" >> $GITHUB_ENV
fi
if [[ "$GITHUB_REF" == "refs/heads/staging" ]]
then
echo "IMAGE_STREAM_TAG=docker-registry.default.svc:5000/voluba/voluba-stg-img-deploy:staging" >> $GITHUB_ENV
fi
- name: "Login via cli"
run: |
if [[ ! -z "$IMAGE_STREAM_TAG" ]]
then
oc login ${{ env.OKD_URL }} --token=${{ secrets.OKD_SECRET }}
oc project voluba
oc import-image $IMAGE_STREAM_TAG
else
echo "Empty IMAGE_STREAM_TAG, skipping"
fi