Skip to content
# Workflow for building OGC application packages
#
# Steps:
#
# 1. Parse the input algorithm config to retrieve the build parameters.
# 2. Build the algorithm executable (docker image).
# 3. Generate the application package process cwl.
# 4. Build the OGC application package executable.
# 4. Push the OGC application package executable to the image registry.
on:
push:
branches:
- main
- feature/app-pack-gen
jobs:
build_ogc_app_pack:
environment: DIT
runs-on: ubuntu-latest
steps:
- name: Checkout repo content
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip list
- name: Generate build config for algorithm
run: python3 generate_build_config.py algorithm_configs/algorithm_config.yaml
- name: Source build config environment variables
uses: c-py/action-dotenv-to-setenv@v5
with:
env-file: .env
- name: Print env params
run: printenv
- name: Log in to GitHub CR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to GitLab CR
uses: docker/login-action@v3
with:
registry: mas.dit.maap-project.org/root/register-job
username: gitlab+deploy-token-6
password: ${{ secrets.OGC_APP_PACK_GEN_CI_GH_ACTION_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
${{ vars.GITLAB_CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}
tags: algorithm
- name: Build and push algorithm Docker image
id: push
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile.algorithm
build-args: |
BASE_IMAGE_NAME=${{ env.BASE_IMAGE_NAME }}
REPO_NAME=${{ env.REPO_NAME }}
BRANCH=${{ env.BRANCH }}
REPO_URL_WITH_TOKEN=${{ env.REPO_URL_WITH_TOKEN }}
BUILD_CMD=${{ env.BUILD_CMD }}
push: true
pull: true
tags: algorithm
labels: ${{ steps.meta.outputs.labels }}
# - name: Build algorithm docker image
# run: |
# docker build -t ${{ env.REPO_NAME }}:${{ env.BRANCH }} \
# --build-arg BASE_IMAGE_NAME=${{ env.BASE_IMAGE_NAME }} \
# --build-arg REPO_NAME=${{ env.REPO_NAME }} \
# --build-arg BRANCH=${{ env.BRANCH }} \
# --build-arg REPO_URL_WITH_TOKEN=${{ env.REPO_URL_WITH_TOKEN }} \
# --build-arg BUILD_CMD=${{ env.BUILD_CMD }} \
# -f docker/Dockerfile.algorithm .
- name: Generate OGC application package process cwl
run: python3 generate_app_pack.py algorithm_configs/algorithm_config.yaml ${{ env.REPO_NAME }}:${{ env.BRANCH }}
- name: Build OGC application package docker image
run: |
docker build -t ogc_${{ env.REPO_NAME }}:${{ env.BRANCH }} \
--build-arg PROCESS_CWL=${{ env.ALGORITHM_NAME }}.${{ env.BRANCH }}.process.cwl \
-f docker/Dockerfile.ogc .
- name: Tag github image
run: docker tag docker.io/library/get-dem:nasa-ogc mas.dit.maap-project.org/root/register-job:get-dem:nasa-ogc
- name: Publish image
run: docker push mas.dit.maap-project.org/root/register-job:get-dem:nasa-ogc
- name: Push OGC application package to GitLab
run: echo Push to image registry not yet implemented.