Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 20 additions & 24 deletions .github/workflows/update_container_image.yaml
Comment thread
Ciheim marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,13 @@ name: Build and Push Container Image

on:
workflow_dispatch:
inputs:
dry_run:
description: "Skip pushing container image"
required: true
default: "true"
type: choice
options: ["true", "false"]

repository_dispatch:
types: [publish-conda-succeeded]
workflow_run:
workflows: ["publish_conda"]
types: [completed]

env:
REGISTRY: ghcr.io
IMAGE_NAME: "noaa-gfdl/ubuntu-20-fre-cli-2025"
IMAGE_NAME: "noaa-gfdl/fre-cli"

jobs:
build-and-push:
Expand All @@ -30,32 +23,35 @@ jobs:
with:
fetch-depth: 0

- name: Determine image tag
- name: Fetch all tags
run: git fetch --tags

- name: Determine latest tag
id: set_tag
run: |
# Use the pushed tag if this is a tag ref; otherwise fall back.
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
TAG="${GITHUB_REF#refs/tags/}"
elif [[ "${GITHUB_REF_NAME}" == "main" ]]; then
TAG="latest"
else
TAG="${GITHUB_SHA::7}"
fi
echo "docker_tag=$TAG" >> "$GITHUB_OUTPUT"
echo "docker_tag=$(git describe --tags --abbrev=0)" >> "$GITHUB_OUTPUT"

- name: Show image tag
run: echo "Docker tag is ${{ steps.set_tag.outputs.docker_tag }}"

- name: Update fre-cli version in cylc-flow-tools.yaml
run: |
sed -i 's/^[[:space:]]*-[[:space:]]*noaa-gfdl::fre-cli==.*/ - noaa-gfdl::fre-cli==${{ steps.set_tag.outputs.docker_tag }}/' ./container-files/cylc-flow-tools.yaml
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cylc-flow-tools.yaml still contains this old tag

dependencies:
  - noaa-gfdl::fre-cli==2025.04

Why not commit the version change update to cylc-flow-tools.yaml?

Copy link
Copy Markdown
Contributor

@singhd789 singhd789 May 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going off of this - the hsm package could also be tagged to 1.4.0 for that hsm update (though the container that is built won't work due to the lack of fregrid - unrelated to hsm)


- name: Log in to the Container registry
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
if: ${{ inputs.dry_run != 'true' }}
- name: Build Docker image
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') }}
uses: docker/build-push-action@v5
with:
context: .
file: ./container-files/Dockerfile-fre-cli
push: true
push: ${{ github.event_name == 'workflow_run' }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.set_tag.outputs.docker_tag }}
3 changes: 3 additions & 0 deletions container-files/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
## Navigate into fre-cli/container-files
cd fre-cli/container-files

## Add the desired frecli version number in cylc-flow-tools.yaml

Check warning on line 32 in container-files/README.md

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (frecli)
ex: noaa-gfdl::fre-cli==2026.01

## Build a container image
podman build -f Dockerfile-fre-cli -t latest

Expand Down Expand Up @@ -91,7 +94,7 @@
## Use apptainer or singularity to run
# Make sure directories are writable
# Bind in necessary locations (setup folder, workflow folder, data locations)
apptainer exec --writable-tmpfs --bind [Path/to/setup/folder]:/mnt --bind [Path/to/fre-worflows]:/mnt2 --bind [Path/to/gridspec location]:/mnt/[experiment-name]_grid:ro --bind [Path/to/history/files]:/mnt/history:ro [Path/to/created/container] /app/exec/runscript.sh

Check warning on line 97 in container-files/README.md

View workflow job for this annotation

GitHub Actions / spellcheck

Misspelled word (worflows) Suggestions: (workflows*)
```
NOTE: It is essential that binding is done correctly as the container’s runscript relies heavily on these paths.

Expand Down
2 changes: 1 addition & 1 deletion container-files/cylc-flow-tools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ channels:
- NOAA-GFDL
dependencies:
- noaa-gfdl::hsm
- noaa-gfdl::fre-cli==2025.04
- noaa-gfdl::fre-cli==XXXX.XX #Add version number manually
- conda-forge::nco
- conda-forge::rsync
- conda-forge::make
Expand Down
Loading