fix siibra jugex version, fix pip install #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: '[docker image]' | |
on: | |
push: | |
branches: | |
- feat_workerFrontend | |
# release: | |
# types: | |
# - published | |
jobs: | |
build-docker-img: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
dockerfile: ['./http.server.dockerfile', './http.worker.dockerfile'] | |
include: | |
- dockerfile: ./http.server.dockerfile | |
dockerimg: siibra-jugex-server | |
- dockerfile: ./http.worker.dockerfile | |
dockerimg: siibra-jugex-worker | |
steps: | |
- uses: actions/checkout@v2 | |
- name: 'Setup tags' | |
run: | | |
VERSION=$(grep -Po '^__version__.*?"\K[\w.]+' http_wrapper/__init__.py) | |
echo "Setting version to $VERSION" | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
DOCKER_IMGSTREAM=${{ secrets.EBRAINS_DOCKER_REG_SIIBRA_TOOLBOX_NSP }}/${{ matrix.dockerimg }} | |
echo "Setting docker image stream to $DOCKER_IMGSTREAM" | |
echo "DOCKER_IMGSTREAM=$DOCKER_IMGSTREAM" >> $GITHUB_ENV | |
- name: 'Build docker image' | |
run: | | |
DOCKER_BUILT_TAG=$DOCKER_IMGSTREAM:$VERSION | |
echo "Building $DOCKER_BUILT_TAG" | |
docker build \ | |
-t $DOCKER_BUILT_TAG \ | |
-f ${{ matrix.dockerfile }} \ | |
. | |
echo "Successfully built $DOCKER_BUILT_TAG" | |
echo "DOCKER_BUILT_TAG=$DOCKER_BUILT_TAG" >> $GITHUB_ENV | |
- name: 'Push to docker registry' | |
run: | | |
echo "Login to docker registry" | |
docker login \ | |
-u '${{ secrets.EBRAINS_DOCKER_REG_SIIBRA_TOOLBOX_PUSHER_USER }}' \ | |
-p '${{ secrets.EBRAINS_DOCKER_REG_SIIBRA_TOOLBOX_PUSHER_PWSD }}' \ | |
${{ secrets.EBRAINS_DOCKER_REG }} | |
echo "Pushing $DOCKER_BUILT_TAG" | |
docker push $DOCKER_BUILT_TAG | |
- name: 'Tag versioned tag to registry' | |
run: | | |
echo "Login to docker registry" | |
docker login \ | |
-u '${{ secrets.EBRAINS_DOCKER_REG_SIIBRA_TOOLBOX_PUSHER_USER }}' \ | |
-p '${{ secrets.EBRAINS_DOCKER_REG_SIIBRA_TOOLBOX_PUSHER_PWSD }}' \ | |
${{ secrets.EBRAINS_DOCKER_REG }} | |
BREAK=5 | |
while [[ "$VERSION" == *"."* ]] | |
do | |
if [[ "$BREAK" == "0" ]] | |
then | |
echo "Fuse broke!" | |
exit 1 | |
fi | |
VERSIONED_DOCKERTAG=$DOCKER_IMGSTREAM:$VERSION | |
echo "tagging and pushing $VERSIONED_DOCKERTAG" | |
docker tag $DOCKER_BUILT_TAG $VERSIONED_DOCKERTAG | |
docker push $VERSIONED_DOCKERTAG | |
echo "Push successful... Incrementing version & break" | |
VERSION=$(echo $VERSION | sed -e 's/\.\w*$//g') | |
BREAK=$(( "$BREAK" - 1 )) | |
done | |
echo "Done" | |
deploy-on-okd: | |
runs-on: ubuntu-latest | |
needs: build-docker-img | |
steps: | |
- name: 'Trigger deploy' | |
run: | | |
if [ ! -z "${{ secrets.EBRAINS_OKD_PRODCSCS_ENDPOINT }}" ] | |
then | |
if [ ! -z "${{ secrets.EBRAINS_OKD_PRODCSCS_SIIBRATOOLBOX_TOKEN }}" ] | |
then | |
oc login ${{ secrets.EBRAINS_OKD_PRODCSCS_ENDPOINT }} --token=${{ secrets.EBRAINS_OKD_PRODCSCS_SIIBRATOOLBOX_TOKEN }} | |
oc project ${{ secrets.EBRAINS_OKD_PRODCSCS_SIIBRATOOLBOX_NSP }} | |
for dc in $(oc get dc -l app=siibra-toolbox-deploy-siibra-toolbox-jugex | awk '{print $1}' | tail -n +2) | |
do | |
oc rollout latest dc/$dc | |
done | |
else | |
echo "secrets.EBRAINS_OKD_PRODCSCS_SIIBRATOOLBOX_TOKEN not set, skipping ..." | |
fi | |
else | |
echo "secrets.EBRAINS_OKD_PRODCSCS_ENDPOINT not set, skipping..." | |
fi |