fix: add pandas to dependency list #27
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
# Build the R container Image | |
name: PR Open | |
on: | |
# used on push for testing / development / debugging | |
# --------------------------------------------------------- | |
# push: | |
# branches: ['feat/23-oc-fire-weather'] | |
# disable the build as its not required anymore... Jobs are going to run as | |
# gha. | |
# pull_request: | |
# # debug: remove the dev,putting build action on non existent branches for debug | |
# branches: ['main'] | |
# types: ['opened', 'reopened', 'edited', 'synchronize'] | |
# paths-ignore: | |
# - .vscode/** | |
# - .flake8 | |
# - .lintr | |
# - .RData | |
# - .Rhistory | |
# - .Rprofile | |
# - .gitignore | |
# - LICENSE | |
# - readme.md | |
# - code_of_conduct.md | |
# - .flake8 | |
# - COMPLIANCE.yaml | |
# - docs/** | |
# - renv.lock | |
# workflow_dispatch: | |
jobs: | |
# calculate the image tag / used to tag image and then for the | |
# deployment will be based on the pull request... for debugging purposes if the | |
# event isn't a pr, then fills in the tag with pr-999. For this | |
# reason should always use the variable created by this step when | |
# tagging or referencing the image tag. | |
CalculateImageTags: | |
defaults: | |
run: | |
shell: bash | |
name: calculateImageTag | |
runs-on: ubuntu-22.04 | |
# declaring variables that will be available by all steps/jobs in this action | |
outputs: | |
imagetag: ${{ steps.CalculateImageTagstep.outputs.IMAGE_TAG}} | |
imagetag-pr: ${{ steps.CalculateImageTagstep.outputs.IMAGE_TAG_PR }} | |
# populate the variables declared above | |
steps: | |
- name: Calculate Image Tag | |
id: CalculateImageTagstep | |
shell: bash | |
run: | | |
DATESTAMP=$(date +%Y%m%d-%H%M) | |
echo datestamp is $DATESTAMP | |
event_num=${{ github.event.number }} | |
if [[ -z "${event_num// }" ]]; then | |
echo "IMAGE_TAG_PR=pr-999" >> "$GITHUB_OUTPUT" | |
else | |
echo "IMAGE_TAG_PR=pr-$event_num" >> "$GITHUB_OUTPUT" | |
fi | |
echo event number: ${{ github.event.number }} | |
echo "IMAGE_TAG=${DATESTAMP}" >> "$GITHUB_OUTPUT" | |
BuildContainerImage: | |
defaults: | |
run: | |
shell: bash | |
needs: CalculateImageTags | |
name: 'Build Container Image' | |
runs-on: ubuntu-22.04 | |
env: | |
DEBUG_DEPLOY: false | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
id: checkout | |
# determine if there are changes in R directory | |
- uses: dorny/paths-filter@v2 | |
id: r-changes | |
with: | |
filters: | | |
r: | |
- 'scripts/r/**' | |
# determine if there are changes to the python directory | |
- uses: dorny/paths-filter@v2 | |
id: py-changes | |
with: | |
filters: | | |
py: | |
- 'scripts/python/**' | |
# echo the image tag in this step - degging purposes and demos a couple | |
# of ways to access the image tag | |
- name: Verify tag | |
id: CalculateImageTagstep | |
shell: bash | |
env: | |
IMAGE_TAG: ${{ needs.CalculateImageTags.outputs.imagetag }} | |
run: | | |
echo image tag is $IMAGE_TAG ${{ env.IMAGE_TAG }} | |
# Log in to the Github Container registry | |
- name: Log in to GitHub Docker Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# build the firedata-pipe image if there are changes to the python directory | |
- name: Build and Push Fire Weather Stations Image | |
uses: docker/build-push-action@v4 | |
env: | |
IMAGE_TAG: ${{ needs.CalculateImageTags.outputs.imagetag }} | |
IMAGE_TAG_PR: ${{ needs.CalculateImageTags.outputs.imagetag-pr }} | |
if: steps.r-changes.outputs.r == 'true' | |
with: | |
push: true # Will only build if this is not here | |
file: r_py_data_prep.Dockerfile | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/firedata_pipe:latest | |
ghcr.io/${{ github.repository_owner }}/firedata_pipe:${{ env.IMAGE_TAG }} | |
ghcr.io/${{ github.repository_owner }}/firedata_pipe:${{ env.IMAGE_TAG_PR }} | |
# if changes haven't occured to the firedata_pipe code then tag the old image | |
# with the tag for this pr number | |
- uses: shrink/actions-docker-registry-tag@v3 | |
if: steps.r-changes.outputs.r != 'true' | |
env: | |
IMAGE_TAG: ${{ needs.CalculateImageTags.outputs.imagetag }} | |
IMAGE_TAG_PR: ${{ needs.CalculateImageTags.outputs.imagetag-pr }} | |
with: | |
registry: ghcr.io | |
repository: ghcr.io/${{ github.repository_owner }}/firedata_pipe | |
target: latest | |
tags: | | |
${{ env.IMAGE_TAG }} | |
${{ env.IMAGE_TAG_PR }} | |
# build the zxs_pipe image if there are changes to the python directory | |
- name: Build and Push ZXS vertical Temperature Profile Image | |
uses: docker/build-push-action@v4 | |
if: steps.py-changes.outputs.py == 'true' | |
env: | |
IMAGE_TAG: ${{ needs.CalculateImageTags.outputs.imagetag }} | |
IMAGE_TAG_PR: ${{ needs.CalculateImageTags.outputs.imagetag-pr }} | |
with: | |
push: true # Will only build if this is not here | |
file: zxs_data_pull.Dockerfile | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/zxs_pipe:latest | |
ghcr.io/${{ github.repository_owner }}/zxs_pipe:${{ env.IMAGE_TAG }} | |
ghcr.io/${{ github.repository_owner }}/zxs_pipe:pr-${{ github.event.number }} | |
# if there were not any changes in the python directory, then tag the old image | |
# with new tags generated by this pr | |
- uses: shrink/actions-docker-registry-tag@v3 | |
if: steps.py-changes.outputs.py != 'true' | |
with: | |
registry: ghcr.io | |
repository: ghcr.io/${{ github.repository_owner }}/zxs_pipe | |
target: latest | |
tags: pr-${{ github.event.number }} | |
# Doing the actual deployment of the container artifacts created in the previous | |
# steps | |
DeployJob: | |
defaults: | |
run: | |
shell: bash | |
needs: [CalculateImageTags, BuildContainerImage] | |
name: 'Deploy the Helm Chart Listener Image' | |
runs-on: ubuntu-22.04 | |
environment: dev | |
# checkout this repo... so files are locally available (required as the helm | |
# chart is in this repo) | |
steps: | |
- uses: actions/checkout@v3 | |
id: checkout | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
# logging into the openshift cluster | |
- name: Log in and set context | |
uses: redhat-actions/oc-login@v1 | |
with: | |
openshift_server_url: ${{ vars.OC_SERVER }} | |
openshift_token: ${{ secrets.OC_TOKEN }} | |
namespace: ${{ vars.OC_NAMESPACE }} | |
# calculate the zone that is going to be used for the deployment | |
- name: Calculate Zone | |
id: calculateZone | |
shell: bash | |
run: | | |
event_num=${{ github.event.number }} | |
if [[ -z "${event_num// }" ]]; then | |
zone=pr-999 | |
else | |
zone=pr-$event_num | |
fi | |
echo zone: $zone | |
echo "ZONE=$zone" >> $GITHUB_ENV | |
# run the actual helm chart | |
- name: Run Helm Chart | |
id: runHelmChart | |
shell: bash | |
env: | |
IMAGE_TAG: ${{ needs.CalculateImageTags.outputs.imagetag }} | |
OBJ_STORE_BUCKET: ${{ secrets.OBJ_STORE_BUCKET }} | |
OBJ_STORE_SECRET: ${{ secrets.OBJ_STORE_SECRET }} | |
OBJ_STORE_USER: ${{ secrets.OBJ_STORE_USER }} | |
OBJ_STORE_HOST: ${{ vars.OBJ_STORE_HOST }} | |
run: | | |
cd cicd | |
helm upgrade --install climateobs-${{ env.ZONE }} climateobs \ | |
--set obj_store.bucket=${{ env.IMAGE_TAG }} \ | |
--set obj_store.host=${{ vars.OBJ_STORE_HOST }} \ | |
--set obj_store.user_id=${{ env.OBJ_STORE_USER }} \ | |
--set obj_store.secret=${{ env.OBJ_STORE_SECRET }} \ | |
--set firedata_image.promote=bcgov/firedata_pipe:${{ env.IMAGE_TAG }} \ | |
--set app.zone=${{ env.ZONE }} \ | |
--set climateobs_job.climateobs_mnt_point=/data |