Skip to content

Commit d74a821

Browse files
authored
Merge pull request #3154 from samsrabin/b4b-dev-merge-20250524
Merge b4b-dev 2025-05-24
2 parents b8f021c + f6fd0d3 commit d74a821

33 files changed

+1217
-111
lines changed

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,6 @@ e8fc526e0d7818d45f171488c78392c4ff63902a
6464
cdf40d265cc82775607a1bf25f5f527bacc97405
6565
251e389b361ba673b508e07d04ddcc06b2681989
6666
8ec50135eca1b99c8b903ecdaa1bd436644688bd
67+
3b7a2876933263f8986e4069f5d23bd45635756f
68+
3dd489af7ebe06566e2c6a1c7ade18550f1eb4ba
69+
742cfa606039ab89602fde5fef46458516f56fd4
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Documentation
3+
about: Something should be added to or fixed in the documentation
4+
5+
---
6+
7+
8+
### What sort(s) of issue is this?
9+
- [ ] Something is missing.
10+
- [ ] Something is (or might be) incorrect.
11+
- [ ] Something is confusing.
12+
- [ ] Something is broken.
13+
14+
### What part(s) of the documentation does this concern?
15+
- [ ] [Technical Note](https://escomp.github.io/ctsm-docs/versions/master/html/tech_note/index.html) (science and design of the model)
16+
- [ ] [User's Guide](https://escomp.github.io/ctsm-docs/versions/master/html/users_guide/index.html) (using the model and related tools)
17+
- [ ] Somewhere else (e.g., README file, tool help text, or code comment): _Please specify_
18+
- [ ] I don't know
19+
20+
### Describe the issue
21+
A clear and concise description of what is missing or wrong.
22+
23+
### Additional context (optional)
24+
Add any other context or screenshots about the issue here.

.github/ISSUE_TEMPLATE/03_other.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/04_other.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
name: Other
3+
about: Other issues (enhancement, cleanup, etc.)
4+
5+
---
6+
7+

.github/workflows/docker-image-build-publish.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
name: Build and publish ctsm-docs Docker image
33

44
on:
5-
# Run this whenever something gets pushed to master
5+
# Run this whenever a change to certain files gets pushed to master
66
push:
77
branches: ['master']
88
paths:
9-
- 'doc/ctsm-docs_container/Dockerfile'
10-
- 'doc/ctsm-docs_container/requirements.txt'
9+
- 'doc/ctsm-docs_container/**'
10+
- '!doc/ctsm-docs_container/README.md'
1111

1212
# Run this whenever it's manually called
1313
workflow_dispatch:
@@ -31,7 +31,7 @@ jobs:
3131
env:
3232
REGISTRY: ${{ needs.build-image-and-test-docs.outputs.REGISTRY }}
3333
IMAGE_NAME: ${{ needs.build-image-and-test-docs.outputs.IMAGE_NAME }}
34-
IMAGE_TAG: ${{ needs.build-image-and-test-docs.outputs.image_tag }}
34+
VERSION_TAG: ${{ needs.build-image-and-test-docs.outputs.version_tag }}
3535

3636
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
3737
permissions:
@@ -61,6 +61,7 @@ jobs:
6161
# This step uses the `docker/build-push-action` action to build the image, based on the ctsm-docs `Dockerfile`.
6262
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see [Usage](https://github.com/docker/build-push-action#usage) in the README of the `docker/build-push-action` repository.
6363
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
64+
# Note that we should avoid relying on the "latest" tag for anything, but it's good practice to have one.
6465
# v6.15.0
6566
- name: Push Docker image
6667
id: push
@@ -70,7 +71,9 @@ jobs:
7071
platforms: linux/amd64,linux/arm64
7172
push: true
7273
load: false
73-
tags: ${{ env.IMAGE_TAG }}
74+
tags: |
75+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
76+
${{ env.VERSION_TAG }}
7477
labels: ""
7578

7679
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see [Using artifact attestations to establish provenance for builds](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds).

.github/workflows/docker-image-build.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
# Modified from https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#publishing-a-package-using-an-action (last accessed 2025-05-09)
22
name: Test building ctsm-docs Docker image and using it to build the docs
33

4-
# Configures this workflow to run every time a change in the Docker container setup is pushed to the master branch
4+
# Configures this workflow to run every time a change in the Docker container setup is pushed or included in a PR
55
on:
66
push:
7+
# Run when a change to these files is pushed to any branch. Without the "branches:" line, for some reason this will be run whenever a tag is pushed, even if the listed files aren't changed.
8+
branches: ['*']
79
paths:
810
- 'doc/ctsm-docs_container/**'
11+
- '!doc/ctsm-docs_container/README.md'
912
- '.github/workflows/docker-image-ctsm-docs-build.yml'
10-
- '.github/workflows/docker-image-build-common.yml'
13+
- '.github/workflows/docker-image-common.yml'
1114

1215
pull_request:
16+
# Run on pull requests that change the listed files
1317
paths:
1418
- 'doc/ctsm-docs_container/**'
19+
- '!doc/ctsm-docs_container/README.md'
1520
- '.github/workflows/docker-image-ctsm-docs-build.yml'
16-
- '.github/workflows/docker-image-build-common.yml'
21+
- '.github/workflows/docker-image-common.yml'
1722

1823
workflow_dispatch:
1924

.github/workflows/docker-image-common.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ on:
99
IMAGE_NAME:
1010
description: "Docker image name"
1111
value: ${{ jobs.build-image-and-test-docs.outputs.IMAGE_NAME }}
12-
image_tag:
13-
description: "First image tag"
14-
value: ${{ jobs.build-image-and-test-docs.outputs.image_tag }}
12+
version_tag:
13+
description: "Version tag from Dockerfile"
14+
value: ${{ jobs.check-version.outputs.VERSION_TAG }}
1515

16-
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
16+
# Defines custom environment variables for the workflow.
1717
env:
1818
REGISTRY: ghcr.io
19-
IMAGE_NAME: ${{ github.repository }}/ctsm-docs
19+
IMAGE_BASENAME: ctsm-docs
20+
REPO: ${{ github.repository }}
2021

2122
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
2223
jobs:
@@ -25,8 +26,7 @@ jobs:
2526
# Variables that might be needed by the calling workflow
2627
outputs:
2728
REGISTRY: ${{ env.REGISTRY }}
28-
IMAGE_NAME: ${{ env.IMAGE_NAME }}
29-
image_tag: ${{ steps.set-image-tag.outputs.IMAGE_TAG }}
29+
IMAGE_NAME: ${{ steps.set-image-name.outputs.IMAGE_NAME }}
3030
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
3131
permissions:
3232
contents: read
@@ -39,6 +39,14 @@ jobs:
3939
- name: Checkout repository
4040
uses: actions/checkout@v4
4141

42+
# Ensure that the repository part of IMAGE_NAME is lowercase. This is needed because Docker requires image names to be entirely lowercase. Note that the *image name* part, set as IMAGE_BASENAME in the env block above, is *not* converted. This will cause the check-version job to fail if the IMAGE_BASENAME contains capitals. We don't want to silently fix that here; rather, we require the user to specify a lowercase IMAGE_BASENAME.
43+
- name: Get image name with lowercase repo
44+
id: set-image-name
45+
run: |
46+
lowercase_repo=$(echo $REPO | tr '[:upper:]' '[:lower:]')
47+
echo "IMAGE_NAME=${lowercase_repo}/${IMAGE_BASENAME}" >> $GITHUB_ENV
48+
echo "IMAGE_NAME=${lowercase_repo}/${IMAGE_BASENAME}" >> $GITHUB_OUTPUT
49+
4250
# Uses the `docker/login-action` action to log in to the Container registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
4351
- name: Log in to the Container registry
4452
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
@@ -52,7 +60,7 @@ jobs:
5260
id: meta
5361
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
5462
with:
55-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
63+
images: ${{ env.REGISTRY }}/${{ steps.set-image-name.outputs.IMAGE_NAME }}
5664

5765
# This step uses the `docker/build-push-action` action to build the image, based on the ctsm-docs `Dockerfile`.
5866
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see [Usage](https://github.com/docker/build-push-action#usage) in the README of the `docker/build-push-action` repository.
@@ -75,9 +83,16 @@ jobs:
7583
- name: Set image tag for docs build
7684
id: set-image-tag
7785
run: |
78-
echo "IMAGE_TAG=$(echo '${{ steps.meta.outputs.tags }}' | cut -d',' -f1)" >> $GITHUB_ENV
79-
echo "IMAGE_TAG=$(echo '${{ steps.meta.outputs.tags }}' | cut -d',' -f1)" >> $GITHUB_OUTPUT
86+
echo "IMAGE_TAG=$(echo '${{ steps.meta.outputs.tags }}' | head -n 1 | cut -d',' -f1)" >> $GITHUB_ENV
8087
- name: Build docs using container
8188
id: build-docs
8289
run: |
8390
cd doc && ./build_docs -b ${PWD}/_build -c -d -i $IMAGE_TAG
91+
92+
93+
check-version:
94+
needs: build-image-and-test-docs
95+
uses: ./.github/workflows/docker-image-get-version.yml
96+
with:
97+
registry: ${{ needs.build-image-and-test-docs.outputs.REGISTRY }}
98+
image_name: ${{ needs.build-image-and-test-docs.outputs.IMAGE_NAME }}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Get and check version specified in a Dockerfile
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
registry:
7+
required: true # Require any workflows calling this one to provide input
8+
type: string
9+
default: 'ghcr.io' # Provide default so this workflow works standalone too
10+
image_name:
11+
required: true # Require any workflows calling this one to provide input
12+
type: string
13+
default: 'escomp/ctsm/ctsm-docs' # Provide default so this workflow works standalone too
14+
outputs:
15+
VERSION_TAG:
16+
description: "Tag to be pushed to container registry"
17+
value: ${{ jobs.get-check-version.outputs.VERSION_TAG }}
18+
workflow_dispatch:
19+
inputs:
20+
registry:
21+
description: 'Container registry'
22+
required: false
23+
type: string
24+
default: 'ghcr.io'
25+
image_name:
26+
description: 'Image name'
27+
required: false
28+
type: string
29+
default: 'escomp/ctsm/ctsm-docs'
30+
31+
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
32+
jobs:
33+
get-check-version:
34+
name: Get version number from Dockerfile and check it
35+
runs-on: ubuntu-latest
36+
outputs:
37+
VERSION_TAG: ${{ steps.get-check-version.outputs.version_tag }}
38+
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
39+
permissions:
40+
contents: read
41+
packages: read
42+
43+
steps:
44+
- name: Check out repository
45+
uses: actions/checkout@v4
46+
47+
- name: Get version number from Dockerfile and check it
48+
id: get-check-version
49+
run: |
50+
set -e
51+
set -o pipefail
52+
set -u
53+
VERSION="$(doc/ctsm-docs_container/get_version.sh)"
54+
VERSION_TAG="${{ inputs.registry }}/${{ inputs.image_name }}:${VERSION}"
55+
56+
# Store the manifest inspect result and output
57+
set +e
58+
INSPECT_RESULT="$(docker manifest inspect "$VERSION_TAG" 2>&1)"
59+
INSPECT_STATUS=$?
60+
set -e
61+
62+
if [[ "${INSPECT_RESULT}" == *"schemaVersion"* ]]; then
63+
echo "Tag $VERSION_TAG already exists!" >&2
64+
exit 123
65+
elif [[ "${INSPECT_RESULT}" != "manifest unknown" ]]; then
66+
# "manifest unknown" means the tag doesn't exist, which is what we want
67+
echo -e "Error checking manifest for $VERSION_TAG:\n${INSPECT_RESULT}" >&2
68+
exit $INSPECT_STATUS
69+
fi
70+
71+
echo "Setting version_tag to $VERSION_TAG"
72+
echo "version_tag=$VERSION_TAG" >> $GITHUB_OUTPUT

.github/workflows/docs-ctsm_pylib.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ name: Test building docs with ctsm_pylib
22

33
on:
44
push:
5+
# Run when a change to these files is pushed to any branch. Without the "branches:" line, for some reason this will be run whenever a tag is pushed, even if the listed files aren't changed.
6+
branches: ['*']
57
paths:
68
- 'python/conda_env_ctsm_py.txt'
79

810
pull_request:
11+
# Run on pull requests that change the listed files
912
paths:
1013
- 'python/conda_env_ctsm_py.txt'
1114

.github/workflows/docs.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,21 @@ name: Test building docs when they're updated
33

44
on:
55
push:
6+
# Run when a change to these files is pushed to any branch. Without the "branches:" line, for some reason this will be run whenever a tag is pushed, even if the listed files aren't changed.
7+
branches: ['*']
68
paths:
79
- 'doc/**'
10+
- '!doc/*ChangeLog*'
11+
- '!doc/*ChangeSum*'
12+
- '!doc/UpdateChangelog.pl'
813

914
pull_request:
15+
# Run on pull requests that change the listed files
1016
paths:
1117
- 'doc/**'
18+
- '!doc/*ChangeLog*'
19+
- '!doc/*ChangeSum*'
20+
- '!doc/UpdateChangelog.pl'
1221

1322
workflow_dispatch:
1423

0 commit comments

Comments
 (0)