Skip to content

doc: wording on drag/drop nifti #1274

doc: wording on drag/drop nifti

doc: wording on drag/drop nifti #1274

Workflow file for this run

name: '[docker image]'
on:
push:
branches:
- "master"
- "staging"
# do not rebuild if...
paths-ignore:
# changes to .openshift directory... mostly devops config
- '.openshift/*'
# docs (docs are built on readthedocs any way)
- 'docs/**/*'
jobs:
set-vars:
runs-on: ubuntu-latest
outputs:
GIT_DIGEST: ${{ steps.set-vars-step.outputs.GIT_DIGEST }}
BRANCH_NAME: ${{ steps.set-vars-step.outputs.BRANCH_NAME }}
BUILD_TEXT: ${{ steps.set-vars-step.outputs.BUILD_TEXT }}
DEPLOY_ID: ${{ steps.set-vars-step.outputs.DEPLOY_ID }}
SXPLR_VERSION: ${{ steps.set-vars-step.outputs.SXPLR_VERSION }}
steps:
- uses: actions/checkout@v4
- id: 'set-vars-step'
name: Set variables
run: |
GIT_DIGEST=${{ github.sha }}
echo "Git digest: $GIT_DIGEST"
GIT_DIGEST=$(echo $GIT_DIGEST | grep -oP '^.{6}')
echo "Using first 6 chars of hash: $GIT_DIGEST"
echo "GIT_DIGEST=$GIT_DIGEST" >> $GITHUB_OUTPUT
echo "Using github.ref: $GITHUB_REF"
BRANCH_NAME=${GITHUB_REF#refs/heads/}
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
echo "Branch is $BRANCH_NAME ."
if [[ "$BRANCH_NAME" == 'master' ]]
then
echo "BUILD_TEXT=" >> $GITHUB_OUTPUT
else
echo "BUILD_TEXT=$BRANCH_NAME" >> $GITHUB_OUTPUT
fi
# DEPLOY_ID == remove _ / and lowercase everything from branch
DEPLOY_ID=$(echo ${BRANCH_NAME//[_\/]/} | awk '{ print tolower($0) }')
echo "DEPLOY_ID=$DEPLOY_ID" >> $GITHUB_OUTPUT
SXPLR_VERSION=$(jq -r '.version' package.json)
echo "SXPLR_VERSION=$SXPLR_VERSION"
echo "SXPLR_VERSION=$SXPLR_VERSION" >> $GITHUB_OUTPUT
build-docker-img:
runs-on: ubuntu-latest
needs:
- set-vars
env:
MATOMO_ID_PROD: '12'
MATOMO_URL_PROD: 'https://stats.humanbrainproject.eu/'
PRODUCTION: 'true'
DOCKER_REGISTRY: 'docker-registry.ebrains.eu/siibra/'
SIIBRA_API_STABLE: 'https://siibra-api-stable.apps.hbp.eu/v3_0,https://siibra-api-prod.apps.tc.humanbrainproject.eu/v3_0'
SIIBRA_API_RC: 'https://siibra-api-rc.apps.hbp.eu/v3_0'
SIIBRA_API_LATEST: 'https://siibra-api-latest.apps-dev.hbp.eu/v3_0'
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: 'Set matomo env var'
run: |
echo "Using github.ref: $GITHUB_REF"
echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "MATOMO_URL=${{ env.MATOMO_URL_PROD }}" >> $GITHUB_ENV
echo "MATOMO_ID=${{ env.MATOMO_ID_PROD }}" >> $GITHUB_ENV
if [[ "$GITHUB_REF" == 'refs/heads/master' ]]
then
echo "Either master, using prod env..."
echo "SIIBRA_API_ENDPOINTS=${{ env.SIIBRA_API_STABLE }}" >> $GITHUB_ENV
elif [[ "$GITHUB_REF" == 'refs/heads/staging' ]]
then
echo "Either staging, using staging env..."
echo "SIIBRA_API_ENDPOINTS=${{ env.SIIBRA_API_RC }}" >> $GITHUB_ENV
else
echo "Currently, only master and staging are built"
exit 1
fi
- name: 'Set version variable & expmt feature flag'
run: |
if [[ "$GITHUB_REF" == 'refs/heads/master' ]] || [[ "$GITHUB_REF" == 'refs/heads/staging' ]]
then
echo "prod/staging build, do not enable experimental features"
else
echo "dev bulid, enable experimental features"
fi
- id: 'build-docker-image'
name: 'Build docker image'
run: |
GIT_DIGEST=${{ needs.set-vars.outputs.GIT_DIGEST }}
echo "Git digest: $GIT_DIGEST"
DOCKER_BUILT_TAG=${{ env.DOCKER_REGISTRY }}siibra-explorer:$BRANCH_NAME
echo "Building $DOCKER_BUILT_TAG"
docker build \
--build-arg BUILD_HASH=$GIT_DIGEST \
--build-arg MATOMO_URL=$MATOMO_URL \
--build-arg MATOMO_ID=$MATOMO_ID \
--build-arg SIIBRA_API_ENDPOINTS=$SIIBRA_API_ENDPOINTS \
--build-arg EXPERIMENTAL_FEATURE_FLAG=$EXPERIMENTAL_FEATURE_FLAG \
-t $DOCKER_BUILT_TAG \
.
echo "Successfully built $DOCKER_BUILT_TAG"
echo "DOCKER_BUILT_TAG=$DOCKER_BUILT_TAG" >> $GITHUB_ENV
inspect_str=$(docker image inspect --format='json' $DOCKER_BUILT_TAG)
echo "Inspected tag: $inspect_str"
- 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_BUILT_TAG"
docker push $DOCKER_BUILT_TAG
- name: 'If master, also tag as per package.json'
if: ${{ github.ref == 'refs/heads/master' }}
run: |
VERSION=$(jq -r '.version' package.json)
VERSIONED_DOCKER_BUILT_TAG=${{ env.DOCKER_REGISTRY }}siibra-explorer:$VERSION
docker tag $DOCKER_BUILT_TAG $VERSIONED_DOCKER_BUILT_TAG
docker push $VERSIONED_DOCKER_BUILT_TAG
trigger-deploy-rc-rancher:
if: ${{ needs.set-vars.outputs.BRANCH_NAME == 'staging' && success() }}
needs:
- build-docker-img
- set-vars
uses: ./.github/workflows/deploy-helm.yml
with:
DEPLOYMENT_NAME: rc
IMAGE_TAG: staging
# GIT_DIGEST may (sometimes) be all numbers. prepend 'h' to cast to str
IMAGE_DIGEST: h${{ needs.set-vars.outputs.GIT_DIGEST }}
secrets:
KUBECONFIG: ${{ secrets.KUBECONFIG }}
cypress-staging-viewer:
needs:
- trigger-deploy-rc-rancher
- set-vars
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
# - windows-latest
- macos-latest
viewer:
- ng
- fsa
browser:
- chrome
- webkit
include:
- viewer: ng
saneurl: human
- viewer: fsa
saneurl: fsaverage
exclude:
- os: ubuntu-latest
browser: webkit
# - os: windows-latest
# browser: webkit
uses: ./.github/workflows/_screenshot.yml
with:
url: https://atlases.ebrains.eu/viewer-staging/go/${{ matrix.saneurl }}
screenshot-filename: ${{ needs.set-vars.outputs.GIT_DIGEST }}/viewer-preview/${{ matrix.viewer }}_${{ matrix.os }}_${{ matrix.browser }}
secrets:
client-id: ${{ secrets.EBRAINS_SIIBRA_EXPLORER_OIDC_CLIENTID}}
client-secret: ${{ secrets.EBRAINS_SIIBRA_EXPLORER_OIDC_CLIENTSECRET}}
cypress-staging-url:
needs:
- trigger-deploy-rc-rancher
- set-vars
strategy:
fail-fast: false
matrix:
saneurl:
- siibra_paper_2023_2A
- siibra_paper_2023_2B
- siibra_paper_2023_2C
- siibra_paper_2023_2D
- siibra_paper_2023_2E
- siibra_paper_2023_2F
uses: ./.github/workflows/_screenshot.yml
with:
url: https://atlases.ebrains.eu/viewer-staging/go/${{ matrix.saneurl }}
screenshot-filename: ${{ needs.set-vars.outputs.GIT_DIGEST }}/url-preview/${{ matrix.saneurl }}
secrets:
client-id: ${{ secrets.EBRAINS_SIIBRA_EXPLORER_OIDC_CLIENTID}}
client-secret: ${{ secrets.EBRAINS_SIIBRA_EXPLORER_OIDC_CLIENTSECRET}}
trigger-deploy-expmt-rancher:
if: ${{ needs.set-vars.outputs.BRANCH_NAME == 'staging' && success() }}
needs:
- build-docker-img
- set-vars
uses: ./.github/workflows/deploy-helm.yml
with:
DEPLOYMENT_NAME: expmt
IMAGE_TAG: staging
# GIT_DIGEST may (sometimes) be all numbers. prepend 'h' to cast to str
IMAGE_DIGEST: h${{ needs.set-vars.outputs.GIT_DIGEST }}
secrets:
KUBECONFIG: ${{ secrets.KUBECONFIG }}
trigger-deploy-master-rancher:
if: ${{ needs.set-vars.outputs.BRANCH_NAME == 'master' && success() }}
needs:
- build-docker-img
- set-vars
uses: ./.github/workflows/deploy-helm.yml
with:
DEPLOYMENT_NAME: prod
IMAGE_TAG: ${{ needs.set-vars.outputs.SXPLR_VERSION }}
# GIT_DIGEST may (sometimes) be all numbers. prepend 'h' to cast to str
IMAGE_DIGEST: h${{ needs.set-vars.outputs.GIT_DIGEST }}
secrets:
KUBECONFIG: ${{ secrets.KUBECONFIG }}