Skip to content

fix custom src

fix custom src #69

Workflow file for this run

name: '[docker image]'
on:
push:
branches:
- master
- staging
- rf_rewriteFrontend
# 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
env:
DOCKERIMG: voluba
outputs:
VERSION: ${{ steps.setting-vars.outputs.VERSION }}
steps:
- uses: actions/checkout@v4
- name: 'Setup tags'
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/rf_rewriteFrontend' ]]; then
echo "DOCKERIMG=voluba:rf_rewriteFrontend" >> "$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: 'Build docker image'
run: |
echo "Building $DOCKER_IMGSTREAM"
docker build \
-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
- name: 'Tag and push version'
if: ${{ github.ref == 'refs/heads/master' }}
run: |
VERSIONED_DOCKER_IMGSTREAM=${{ secrets.EBRAINS_DOCKER_REG_VOLUBA_NSP }}/${{ env.DOCKERIMG }}:$VERSION
echo "Tagging and pushing $VERSIONED_DOCKER_IMGSTREAM"
docker tag $DOCKER_IMGSTREAM $VERSIONED_DOCKER_IMGSTREAM
docker login \
-u '${{ secrets.EBRAINS_DOCKER_REG_USER }}' \
-p '${{ secrets.EBRAINS_DOCKER_REG_TOKEN }}' \
docker-registry.ebrains.eu
docker push $VERSIONED_DOCKER_IMGSTREAM
deploy-prod-on-rancher:
needs: [ build-docker-img ]
if: ${{ github.ref == 'refs/heads/master' && success() }}
uses: ./.github/workflows/deploy-helm.yml
with:
DEPLOYMENT_NAME: voluba-prod
IMAGE_TAG: ${{ needs.build-docker-img.outputs.VERSION }}
secrets:
KUBECONFIG: ${{ secrets.KUBECONFIG }}
deploy-rc-on-rancher:
needs: [ build-docker-img ]
if: ${{ github.ref == 'refs/heads/staging' && success() }}
uses: ./.github/workflows/deploy-helm.yml
with:
DEPLOYMENT_NAME: voluba-rc
IMAGE_TAG: staging
secrets:
KUBECONFIG: ${{ secrets.KUBECONFIG }}
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