Skip to content

Commit bc3fb49

Browse files
authored
Merge pull request #214 from NatLabRockies/image-tag-logic
feat: add workflow_dispatch for on-demand .sif builds and update to ubuntu-24.04
2 parents 65784b2 + 66b15f8 commit bc3fb49

4 files changed

Lines changed: 75 additions & 9 deletions

File tree

.github/workflows/docker-openstudio.yml

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
11
name: openstudio-docker
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- develop
8+
pull_request:
9+
workflow_dispatch:
10+
inputs:
11+
openstudio_version:
12+
description: 'OpenStudio version (e.g. 3.10.0)'
13+
required: true
14+
default: '3.11.0'
15+
openstudio_sha:
16+
description: 'OpenStudio git SHA'
17+
required: true
18+
default: 'dee62bf9dd'
19+
openstudio_version_ext:
20+
description: 'Version extension (e.g. -rc1). Leave blank for a final release. Default: -rc1'
21+
required: false
22+
default: ''
23+
apptainer_only:
24+
description: 'Skip docker build/test and only build the .sif from an existing Docker Hub image'
25+
required: false
26+
default: 'false'
27+
type: boolean
428

529
# example of how to restrict to one branch and push event
630
#on:
@@ -17,21 +41,57 @@ env:
1741
OPENSTUDIO_VERSION: 3.11.0
1842
OPENSTUDIO_SHA: dee62bf9dd
1943
OPENSTUDIO_VERSION_EXT: "-rc1"
20-
OPENSTUDIO_DOWNLOAD_URL: "https://openstudio-ci-builds.s3-us-west-2.amazonaws.com/develop/OpenStudio-3.11.0-rc1%2Bdee62bf9dd-Ubuntu-22.04-x86_64.deb"
44+
OPENSTUDIO_DOWNLOAD_URL: "https://openstudio-ci-builds.s3-us-west-2.amazonaws.com/develop/OpenStudio-3.11.0-rc1%2Bdee62bf9dd-Ubuntu-24.04-x86_64.deb"
2145

2246
permissions:
2347
contents: read
2448

2549
jobs:
50+
setup:
51+
runs-on: ubuntu-24.04
52+
outputs:
53+
openstudio_version: ${{ steps.resolve.outputs.openstudio_version }}
54+
openstudio_sha: ${{ steps.resolve.outputs.openstudio_sha }}
55+
openstudio_version_ext: ${{ steps.resolve.outputs.openstudio_version_ext }}
56+
steps:
57+
- name: Resolve version
58+
id: resolve
59+
shell: bash
60+
run: |
61+
# Start from workflow-level defaults
62+
VERSION="${OPENSTUDIO_VERSION}"
63+
SHA="${OPENSTUDIO_SHA}"
64+
EXT="${OPENSTUDIO_VERSION_EXT}"
65+
66+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
67+
# Override version/sha if provided (they are required inputs so always non-empty)
68+
VERSION="${{ inputs.openstudio_version }}"
69+
SHA="${{ inputs.openstudio_sha }}"
70+
# Unconditionally assign ext — empty string IS a valid value (final release)
71+
# Do NOT use || here: "" || "-rc1" evaluates to "-rc1" in GHA expressions
72+
EXT="${{ inputs.openstudio_version_ext }}"
73+
fi
74+
75+
echo "openstudio_version=${VERSION}" >> "$GITHUB_OUTPUT"
76+
echo "openstudio_sha=${SHA}" >> "$GITHUB_OUTPUT"
77+
echo "openstudio_version_ext=${EXT}" >> "$GITHUB_OUTPUT"
78+
echo "Resolved: OpenStudio ${VERSION}${EXT} (${SHA})"
79+
2680
docker:
81+
needs: setup
2782
runs-on: ubuntu-24.04
83+
env:
84+
OPENSTUDIO_VERSION: ${{ needs.setup.outputs.openstudio_version }}
85+
OPENSTUDIO_SHA: ${{ needs.setup.outputs.openstudio_sha }}
86+
OPENSTUDIO_VERSION_EXT: ${{ needs.setup.outputs.openstudio_version_ext }}
2887
steps:
2988
- uses: actions/checkout@v4
3089
- uses: actions/setup-python@v5
3190
with:
3291
python-version: '3.12.x'
3392

3493
- name: test and build
94+
if: ${{ github.event.inputs.apptainer_only != 'true' }}
3595
shell: bash
3696
run: |
3797
set -euo pipefail
@@ -56,8 +116,12 @@ jobs:
56116

57117
apptainer:
58118
runs-on: ubuntu-24.04
59-
needs: docker
60-
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/custom_branch_name' }}
119+
needs: [setup, docker]
120+
if: ${{ github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/custom_branch_name' }}
121+
env:
122+
OPENSTUDIO_VERSION: ${{ needs.setup.outputs.openstudio_version }}
123+
OPENSTUDIO_SHA: ${{ needs.setup.outputs.openstudio_sha }}
124+
OPENSTUDIO_VERSION_EXT: ${{ needs.setup.outputs.openstudio_version_ext }}
61125
permissions:
62126
contents: read
63127
id-token: write

.github/workflows/manual_installer_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ on:
66
os_installer_link:
77
description: 'The Link where to download the LINUX OpenStudio SDK Installer (.DEB)'
88
required: true
9-
default: 'https://github.com/NREL/OpenStudio/releases/download/v3.4.0/OpenStudio-3.4.0+4bd816f785-Ubuntu-20.04.deb'
9+
default: 'https://github.com/NREL/OpenStudio/releases/download/v3.4.0/OpenStudio-3.4.0+4bd816f785-Ubuntu-24.04.deb'
1010
os_version:
1111
description: 'OS version (e.g. 3.4.0). Must match .deb installer'
1212
required: true
1313
os_version_ext:
1414
description: 'OS version extension (e.g. -alpha). Must match .deb installer'
1515
required: false
1616
docker_image_tag:
17-
description: 'Docker image tag. Tag name will be prefixed with "dev-" unless tag = "develop"'
17+
description: 'Docker image tag. If tag is "develop", it will be "develop". If tag matches a version pattern (e.g. 3.11.0-rc3), it will be used as-is. Otherwise, tag will be prefixed with "dev-".'
1818
required: true
1919

2020
env:

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:22.04 AS base
1+
FROM ubuntu:24.04 AS base
22

33
LABEL maintainer="Nicholas Long nicholas.long@nrel.gov"
44

@@ -34,9 +34,9 @@ RUN apt-get update && apt-get install -y \
3434
&& if [ -z "${OPENSTUDIO_DOWNLOAD_URL}" ]; then \
3535
ESC_VERSION=$(echo "${OPENSTUDIO_VERSION}${OPENSTUDIO_VERSION_EXT}" | sed 's/+/%2B/g'); \
3636
if [ -n "${OPENSTUDIO_SHA}" ]; then \
37-
OPENSTUDIO_DOWNLOAD_URL="https://openstudio-ci-builds.s3.amazonaws.com/develop/OpenStudio-${ESC_VERSION}%2B${OPENSTUDIO_SHA}-Ubuntu-22.04-x86_64.deb"; \
37+
OPENSTUDIO_DOWNLOAD_URL="https://openstudio-ci-builds.s3.amazonaws.com/develop/OpenStudio-${ESC_VERSION}%2B${OPENSTUDIO_SHA}-Ubuntu-24.04-x86_64.deb"; \
3838
else \
39-
OPENSTUDIO_DOWNLOAD_URL="https://openstudio-ci-builds.s3.amazonaws.com/develop/OpenStudio-${ESC_VERSION}-Ubuntu-22.04-x86_64.deb"; \
39+
OPENSTUDIO_DOWNLOAD_URL="https://openstudio-ci-builds.s3.amazonaws.com/develop/OpenStudio-${ESC_VERSION}-Ubuntu-24.04-x86_64.deb"; \
4040
fi; \
4141
fi \
4242
&& echo "OpenStudio Package Download URL is ${OPENSTUDIO_DOWNLOAD_URL}" \

deploy_docker.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ fi
2323
if [ ! -z "${DOCKER_MANUAL_IMAGE_TAG}" ]; then
2424
if [ "${DOCKER_MANUAL_IMAGE_TAG}" == "develop" ]; then
2525
IMAGETAG="develop"
26+
elif [[ "${DOCKER_MANUAL_IMAGE_TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
27+
IMAGETAG="${DOCKER_MANUAL_IMAGE_TAG}"
2628
else
2729
IMAGETAG="dev-${DOCKER_MANUAL_IMAGE_TAG}"
2830
fi

0 commit comments

Comments
 (0)