From ca806eae9fcba0cd0d0395de4d48b92c2c33bbd9 Mon Sep 17 00:00:00 2001 From: Noel Merket Date: Thu, 14 Nov 2024 09:34:35 -0700 Subject: [PATCH 01/20] removing old singularity folder --- singularity/Dockerfile | 37 ---------------- singularity/README.md | 72 ------------------------------- singularity/Singularity | 4 -- singularity/build_singularity.sh | 6 --- singularity/deploy_singularity.sh | 50 --------------------- singularity/index.html | 19 -------- singularity/requirements.txt | 2 - singularity/upload_s3.py | 40 ----------------- 8 files changed, 230 deletions(-) delete mode 100644 singularity/Dockerfile delete mode 100644 singularity/README.md delete mode 100644 singularity/Singularity delete mode 100755 singularity/build_singularity.sh delete mode 100755 singularity/deploy_singularity.sh delete mode 100644 singularity/index.html delete mode 100644 singularity/requirements.txt delete mode 100644 singularity/upload_s3.py diff --git a/singularity/Dockerfile b/singularity/Dockerfile deleted file mode 100644 index b3166e6..0000000 --- a/singularity/Dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -FROM ubuntu:18.04 - -ENV SINGULARITY_VERSION=2.5.1 -# singularity, then other dependencies -RUN apt-get update && apt-get install -y --no-install-recommends build-essential \ - python \ - python-pip \ - python-setuptools \ - libarchive-dev \ - squashfs-tools \ - curl \ - apt-transport-https \ - ca-certificates \ - software-properties-common \ - gnupg \ - vim \ - && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \ - && add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \ - && apt-get update \ - && apt-get install -y --no-install-recommends docker-ce \ - && rm -rf /var/lib/apt/lists/* - -# Build and install singularity -WORKDIR /root/singularity-build -RUN curl -SLO https://github.com/singularityware/singularity/releases/download/$SINGULARITY_VERSION/singularity-$SINGULARITY_VERSION.tar.gz \ - && tar xvf singularity-$SINGULARITY_VERSION.tar.gz \ - && cd singularity-$SINGULARITY_VERSION \ - && ./configure --prefix=/usr/local \ - && make \ - && make install \ - && singularity --version - -COPY singularity/requirements.txt requirements.txt -RUN pip install -r requirements.txt - -WORKDIR /root/build -CMD ['/bin/bash'] \ No newline at end of file diff --git a/singularity/README.md b/singularity/README.md deleted file mode 100644 index 6cd155f..0000000 --- a/singularity/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# Creating Singularity Image - -* Build Singularity/Docker Image - - ```bash - docker build -t singularity -f singularity/Dockerfile . - ``` - -* Build OpenStudio Container (Locally) - - ```bash - # Set the version of OpenStudio to install - export OPENSTUDIO_VERSION=2.6.0 - export OPENSTUDIO_SHA=8c81faf8bc - - docker build -t docker-openstudio --build-arg OPENSTUDIO_VERSION=$OPENSTUDIO_VERSION --build-arg OPENSTUDIO_SHA=$OPENSTUDIO_SHA . - ``` - -* Launch the Container (in privileged mode with docker.sock mounted in the container) - - ```bash - docker run -it --rm --privileged -v $(pwd):/root/build -v /var/run/docker.sock:/var/run/docker.sock singularity bash - ``` - -* Inside singularity build the docker container - - ```bash - - if [ ! "$(docker ps -q -f name=for_export)" ]; then docker rm for_export; else echo "Container does not exist"; fi - # start an instance of the container for export - docker run --name for_export docker-openstudio /bin/true - if [ -f docker-openstudio.simg ]; then rm -f docker-openstudio.simg; else echo "File does not exist"; fi - singularity image.create -s 2000 docker-openstudio.simg - docker export for_export | singularity image.import docker-openstudio.simg - - # test singularity - singularity shell -B $(pwd):/singtest docker-openstudio.simg - # RUBYLIB isn't copied into Singularity container for some reason - export RUBYLIB=/usr/local/openstudio-2.6.0/Ruby - ruby /singtest/test/test.rb - - ``` - -* Exit out of the container and singularity image will be in the docker-openstudio root directory - -# Using Singularity Container - -* Download singularity image from S3 - -``` -curl -SLO https://s3.amazonaws.com/openstudio-builds/2.6.0/OpenStudio-2.6.0.ac20db5eff-Singularity.simg -``` - -* Run singularity container - -``` -module load singularity-container -# Mount /scratch for analysis -singularity shell -B /scratch:/scratch OpenStudio-2.6.0.ac20db5eff-Singularity.simg - -# Call bash (without --norc) for now until LANG is fixed -bash - -openstudio --version -``` - -* Running singularity in line - -``` -singularity exec -B /scratch:/var/simdata/openstudio OpenStudio-2.6.0.ac20db5eff-Singularity.simg openstudio run -w in.osw - - diff --git a/singularity/Singularity b/singularity/Singularity deleted file mode 100644 index fd0c7af..0000000 --- a/singularity/Singularity +++ /dev/null @@ -1,4 +0,0 @@ -Bootstrap: docker -Registry: http://127.0.0.1:5000 -Namespace: -From: docker-openstudio:latest diff --git a/singularity/build_singularity.sh b/singularity/build_singularity.sh deleted file mode 100755 index 4f06106..0000000 --- a/singularity/build_singularity.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Build singularity container -cd singularity -SINGULARITY_NOHTTPS=1 singularity build docker-openstudio.simg Singularity -cp docker-openstudio.simg .. diff --git a/singularity/deploy_singularity.sh b/singularity/deploy_singularity.sh deleted file mode 100755 index 0b6202f..0000000 --- a/singularity/deploy_singularity.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env bash - -# Building a container with singularity installed to build the OpenStudio singularity image -docker build -f singularity/Dockerfile -t singularity . -# OPENSTUDIO_VERSION and OPENSTUDIO_SHA are set by travis -# export OPENSTUDIO_VERSION=2.6.0 -# export OPENSTUDIO_SHA=ac20db5eff -docker build -t docker-openstudio --target base --build-arg OPENSTUDIO_VERSION=$OPENSTUDIO_VERSION --build-arg OPENSTUDIO_SHA=$OPENSTUDIO_SHA --build-arg OPENSTUDIO_VERSION_EXT=$OPENSTUDIO_VERSION_EXT . - -# Start the registry and push docker-openstudio -docker run -d -p 5000:5000 --restart=always --name registry registry:2 -sleep 5 -docker tag docker-openstudio localhost:5000/docker-openstudio -docker push localhost:5000/docker-openstudio - -docker ps - -# Launch the singularity container -docker run --rm --privileged --network=container:registry -v $(pwd):/root/build -v /var/run/docker.sock:/var/run/docker.sock singularity /root/build/singularity/build_singularity.sh - -# Shut down and remove the local registry -docker container stop registry && docker container rm -v registry - -ls -altR - -# Test with non-root user. The -u 1000 is not needed when testing locally on OSX. -# docker run -it --rm --privileged -u 1000 -v $(pwd):/root/build -v /var/run/docker.sock:/var/run/docker.sock singularity bash -# singularity shell -B $(pwd):/singtest docker-openstudio.simg -#ruby /singtest/test/test.rb -#ls -alR - -# Determine the name of the tag -IMAGETAG=skip -if [ "${GITHUB_REF}" == "refs/heads/develop" ]; then - IMAGETAG=develop -elif [ "${GITHUB_REF}" == "refs/heads/2.9.X-LTS" ]; then - IMAGETAG="2.9.X-LTS" -elif [ "${GITHUB_REF}" == "refs/heads/master" ]; then - IMAGETAG=${OPENSTUDIO_VERSION}${OPENSTUDIO_VERSION_EXT} - # Uncomment and set branch name for custom builds. -elif [ "${GITHUB_REF}" == "refs/heads/custom_branch_name" ]; then - IMAGETAG=experimental -fi - -# upload to s3. The OPENSTUDIO_SHA is taken from the env vars -if [ "$IMAGETAG" != "skip" ]; then - pip install -r singularity/requirements.txt - python singularity/upload_s3.py -fi - diff --git a/singularity/index.html b/singularity/index.html deleted file mode 100644 index d857623..0000000 --- a/singularity/index.html +++ /dev/null @@ -1,19 +0,0 @@ -
- - - - - - - - - \ No newline at end of file diff --git a/singularity/requirements.txt b/singularity/requirements.txt deleted file mode 100644 index ea948fa..0000000 --- a/singularity/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -boto3 -requests diff --git a/singularity/upload_s3.py b/singularity/upload_s3.py deleted file mode 100644 index e9b1ab0..0000000 --- a/singularity/upload_s3.py +++ /dev/null @@ -1,40 +0,0 @@ -import boto3 -import os -import argparse - - -def image_file_name_and_s3_key(basename, version, sha=None): - name = '%s-%s-Singularity.simg' % (basename, version) - if sha: - name = '%s-%s.%s-Singularity.simg' % (basename, version, sha) - s3_key = '%s/%s' % (version, name) - - return s3_key - - -def main(): - print("Starting upload_s3.py") - parser = argparse.ArgumentParser(description='Upload file to S3 with version and SHA') - parser.add_argument('--version', default=None) - parser.add_argument('--sha', default=None) - args = parser.parse_args() - - if args.version is None: - args.version = os.getenv('OPENSTUDIO_VERSION', 'latest') - if args.sha is None: - args.sha = os.getenv('OPENSTUDIO_SHA', None) - - print(args) - ############# Script ################ - s3 = boto3.client('s3') - bucket_name = 'openstudio-builds' - filename = 'docker-openstudio.simg' - if os.path.exists(filename): - s3_key = image_file_name_and_s3_key('OpenStudio', args.version, args.sha) - print("Uploading %s to %s" % (filename, s3_key)) - data = open(filename, 'rb') - s3.put_object(Bucket=bucket_name, Key=s3_key, Body=data) - - -if __name__ == '__main__': - main() From 678f2a37f3c7b634121d972a17bcae1bef4bc7b2 Mon Sep 17 00:00:00 2001 From: anchapin Date: Fri, 28 Mar 2025 17:10:02 -0400 Subject: [PATCH 02/20] Add gem installation for zip in Dockerfile --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index a1a68ba..36599df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -64,6 +64,7 @@ RUN if [ -d "/usr/local/openstudio-${OPENSTUDIO_VERSION}" ]; then \ && echo "OpenStudio folder is ${OPENSTUDIO_FOLDER}" \ && rm -rf ruby* \ && gem install bundler -v $OS_BUNDLER_VERSION \ + && gem install zip \ && mkdir /var/oscli \ && ls /usr/local \ && cp ${OPENSTUDIO_FOLDER}/Ruby/Gemfile /var/oscli/ \ From 2dc39f4e06401fcd138f7a59622aabf6cd289aee Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Mon, 7 Apr 2025 10:52:43 +0200 Subject: [PATCH 03/20] Update Dockerfile check for bundle_path openstudio_version will not try to load the gems. cf https://github.com/NREL/OpenStudio/issues/5388#issuecomment-2782506469 --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 36599df..c237b7b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -87,8 +87,8 @@ RUN bundle _${OS_BUNDLER_VERSION}_ install --path=gems --without=native_ext --jo # Configure the bootdir & confirm that openstudio is able to load the bundled gem set in /var/gemdata VOLUME /var/simdata/openstudio WORKDIR /var/simdata/openstudio -RUN openstudio --loglevel Trace --bundle /var/oscli/Gemfile --bundle_path /var/oscli/gems --bundle_without native_ext openstudio_version +RUN openstudio --loglevel Trace --bundle /var/oscli/Gemfile --bundle_path /var/oscli/gems --bundle_without native_ext gem_list # May need this for syscalls that do not have ext in path -CMD [ "/bin/bash" ] \ No newline at end of file +CMD [ "/bin/bash" ] From e84e6d6197609e062303c149443a31672d618a32 Mon Sep 17 00:00:00 2001 From: TJC Date: Fri, 2 May 2025 12:41:32 -0600 Subject: [PATCH 04/20] Update manual_installer_test.yml Bump runner from 20.04 to 24.04 --- .github/workflows/manual_installer_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/manual_installer_test.yml b/.github/workflows/manual_installer_test.yml index 9d48d0c..948b7dd 100644 --- a/.github/workflows/manual_installer_test.yml +++ b/.github/workflows/manual_installer_test.yml @@ -25,7 +25,7 @@ env: jobs: build_container: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 From a03172c697897c6431898ae485b5bcb4f9c7a497 Mon Sep 17 00:00:00 2001 From: Brian Ball Date: Fri, 9 May 2025 10:26:51 -0500 Subject: [PATCH 05/20] 20.04 -> 22.04; @v2->@v4 --- .github/workflows/docker-openstudio.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-openstudio.yml b/.github/workflows/docker-openstudio.yml index 86eedf3..f01f974 100644 --- a/.github/workflows/docker-openstudio.yml +++ b/.github/workflows/docker-openstudio.yml @@ -20,10 +20,10 @@ permissions: jobs: docker: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 with: python-version: '3.8.x' @@ -52,10 +52,10 @@ jobs: DOCKER_USER: ${{ secrets.DOCKER_USER }} apptainer: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 with: python-version: '3.8.x' @@ -73,7 +73,7 @@ jobs: OpenStudio-$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT.$OPENSTUDIO_SHA-Apptainer.sif \ docker://nrel/openstudio:$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: apptainer-image path: OpenStudio-${{ env.OPENSTUDIO_VERSION }}${{ env.OPENSTUDIO_VERSION_EXT }}.${{ env.OPENSTUDIO_SHA }}-Apptainer.sif @@ -91,4 +91,4 @@ jobs: bucket-name: openstudio-builds prefix: ${{env.OPENSTUDIO_VERSION}} file: OpenStudio-${{ env.OPENSTUDIO_VERSION }}${{ env.OPENSTUDIO_VERSION_EXT }}.${{ env.OPENSTUDIO_SHA }}-Apptainer.sif - \ No newline at end of file + From 793b7439488cd4b99913bd0dff213d0bec98f746 Mon Sep 17 00:00:00 2001 From: brianlball Date: Fri, 9 May 2025 11:24:34 -0500 Subject: [PATCH 06/20] 3.10.0-alpha keep OPENSTUDIO_VERSION_EXT with - in Dockerfile to be consistent with GA --- .github/workflows/docker-openstudio.yml | 6 +++--- Dockerfile | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-openstudio.yml b/.github/workflows/docker-openstudio.yml index f01f974..685df36 100644 --- a/.github/workflows/docker-openstudio.yml +++ b/.github/workflows/docker-openstudio.yml @@ -10,9 +10,9 @@ on: [push, pull_request] env: USE_TESTING_TIMEOUTS: "true" - OPENSTUDIO_VERSION: 3.9.0 - OPENSTUDIO_SHA: c77fbb9569 - OPENSTUDIO_VERSION_EXT: "" + OPENSTUDIO_VERSION: 3.10.0 + OPENSTUDIO_SHA: 2B83cec57525 + OPENSTUDIO_VERSION_EXT: "-alpha" permissions: contents: read diff --git a/Dockerfile b/Dockerfile index c237b7b..f35d40f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,9 +3,9 @@ FROM ubuntu:22.04 AS base MAINTAINER Nicholas Long nicholas.long@nrel.gov # Set the version of OpenStudio when building the container. For example `docker build --build-arg -ARG OPENSTUDIO_VERSION=3.9.0 -ARG OPENSTUDIO_VERSION_EXT="" -ARG OPENSTUDIO_DOWNLOAD_URL="https://openstudio-ci-builds.s3.amazonaws.com/master/OpenStudio-3.9.0%2Bc77fbb9569-Ubuntu-22.04-x86_64.deb" +ARG OPENSTUDIO_VERSION=3.10.0 +ARG OPENSTUDIO_VERSION_EXT="-alpha" +ARG OPENSTUDIO_DOWNLOAD_URL="https://openstudio-ci-builds.s3.amazonaws.com/develop/OpenStudio-3.10.0-alpha%2B83cec57525-Ubuntu-22.04-x86_64.deb" ENV RC_RELEASE=TRUE ENV OS_BUNDLER_VERSION=2.4.10 ENV RUBY_VERSION=3.2.2 @@ -58,8 +58,8 @@ RUN if [ -d "/usr/local/openstudio-${OPENSTUDIO_VERSION}" ]; then \ echo "OpenStudio folder is /usr/local/openstudio-${OPENSTUDIO_VERSION}"; \ OPENSTUDIO_FOLDER=/usr/local/openstudio-${OPENSTUDIO_VERSION}; \ else \ - echo "OpenStudio folder is /usr/local/openstudio-${OPENSTUDIO_VERSION}-${OPENSTUDIO_VERSION_EXT}"; \ - OPENSTUDIO_FOLDER=/usr/local/openstudio-${OPENSTUDIO_VERSION}-${OPENSTUDIO_VERSION_EXT}; \ + echo "OpenStudio folder is /usr/local/openstudio-${OPENSTUDIO_VERSION}${OPENSTUDIO_VERSION_EXT}"; \ + OPENSTUDIO_FOLDER=/usr/local/openstudio-${OPENSTUDIO_VERSION}${OPENSTUDIO_VERSION_EXT}; \ fi \ && echo "OpenStudio folder is ${OPENSTUDIO_FOLDER}" \ && rm -rf ruby* \ From fa1862df5bcbfa39f3846b196745a434c01bd441 Mon Sep 17 00:00:00 2001 From: brianlball Date: Fri, 9 May 2025 11:38:21 -0500 Subject: [PATCH 07/20] apptainer use develop branch tag until 3.10.0 is on dockerhub --- .github/workflows/docker-openstudio.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-openstudio.yml b/.github/workflows/docker-openstudio.yml index 685df36..352e4db 100644 --- a/.github/workflows/docker-openstudio.yml +++ b/.github/workflows/docker-openstudio.yml @@ -71,7 +71,8 @@ jobs: run: | apptainer build \ OpenStudio-$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT.$OPENSTUDIO_SHA-Apptainer.sif \ - docker://nrel/openstudio:$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT +# docker://nrel/openstudio:$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT + docker://nrel/openstudio:develop - uses: actions/upload-artifact@v4 with: From 90f8742894947d4d3275fb8243628e5808cc1564 Mon Sep 17 00:00:00 2001 From: brianlball Date: Fri, 9 May 2025 11:44:09 -0500 Subject: [PATCH 08/20] fix yml indent typo --- .github/workflows/docker-openstudio.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-openstudio.yml b/.github/workflows/docker-openstudio.yml index 352e4db..d0adb14 100644 --- a/.github/workflows/docker-openstudio.yml +++ b/.github/workflows/docker-openstudio.yml @@ -71,8 +71,9 @@ jobs: run: | apptainer build \ OpenStudio-$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT.$OPENSTUDIO_SHA-Apptainer.sif \ -# docker://nrel/openstudio:$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT docker://nrel/openstudio:develop + #docker://nrel/openstudio:$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT + - uses: actions/upload-artifact@v4 with: From b7256431c5b218dca563444a145a4f4aee6e02da Mon Sep 17 00:00:00 2001 From: anchapin Date: Wed, 19 Nov 2025 10:01:02 -0500 Subject: [PATCH 09/20] Update GitHub Actions versions and runner OS - Update actions/checkout from v2 to v4 - Update actions/setup-python from v2 to v5 - Update Python version from 3.8.x to 3.11.x - Update runner OS from ubuntu-20.04 to ubuntu-24.04 These updates ensure compatibility with current GitHub Actions infrastructure and resolve deprecation warnings. --- .github/workflows/manual_installer_test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/manual_installer_test.yml b/.github/workflows/manual_installer_test.yml index 9d48d0c..459a093 100644 --- a/.github/workflows/manual_installer_test.yml +++ b/.github/workflows/manual_installer_test.yml @@ -25,13 +25,13 @@ env: jobs: build_container: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: '3.8.x' + python-version: '3.11.x' - name: test and build shell: bash From 7906ff8d15383a0abe34e93eaedcda7de55a736a Mon Sep 17 00:00:00 2001 From: anchapin Date: Wed, 19 Nov 2025 10:11:18 -0500 Subject: [PATCH 10/20] Update GitHub Actions workflow to use Ubuntu 22.04 and upgrade OpenStudio version to 3.11.0 --- .github/workflows/docker-openstudio.yml | 135 +++++++++++++----------- 1 file changed, 71 insertions(+), 64 deletions(-) diff --git a/.github/workflows/docker-openstudio.yml b/.github/workflows/docker-openstudio.yml index 86eedf3..4b17622 100644 --- a/.github/workflows/docker-openstudio.yml +++ b/.github/workflows/docker-openstudio.yml @@ -8,87 +8,94 @@ on: [push, pull_request] # branches: # - test_branch +concurrency: + group: openstudio-docker-${{ github.ref }} + cancel-in-progress: true + env: USE_TESTING_TIMEOUTS: "true" - OPENSTUDIO_VERSION: 3.9.0 - OPENSTUDIO_SHA: c77fbb9569 + OPENSTUDIO_VERSION: 3.11.0 + OPENSTUDIO_SHA: c7f13ad OPENSTUDIO_VERSION_EXT: "" permissions: contents: read - id-token: write jobs: docker: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: '3.8.x' + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.11.x' - - name: test and build - shell: bash - run: | + - name: test and build + shell: bash + run: | + set -euo pipefail docker build -t openstudio:latest \ - --build-arg OPENSTUDIO_VERSION=$OPENSTUDIO_VERSION \ - --build-arg OPENSTUDIO_SHA=$OPENSTUDIO_SHA \ - --build-arg OPENSTUDIO_VERSION_EXT=$OPENSTUDIO_VERSION_EXT \ - --build-arg DOWNLOAD_PREFIX=$DOWNLOAD_PREFIX . + --build-arg OPENSTUDIO_VERSION=$OPENSTUDIO_VERSION \ + --build-arg OPENSTUDIO_SHA=$OPENSTUDIO_SHA \ + --build-arg OPENSTUDIO_VERSION_EXT=$OPENSTUDIO_VERSION_EXT . docker run openstudio:latest openstudio openstudio_version docker run openstudio:latest /usr/local/openstudio-$OPENSTUDIO_VERSION/Radiance/bin/rtrace -version - docker run -v $(pwd):/var/simdata/openstudio openstudio:latest ruby /var/simdata/openstudio/test/test_run.rb - docker run -v $(pwd)/test:/var/simdata/openstudio openstudio:latest ./test_gemfile.sh + docker run -v "$(pwd)":/var/simdata/openstudio openstudio:latest ruby /var/simdata/openstudio/test/test_run.rb + docker run -v "$(pwd)/test":/var/simdata/openstudio openstudio:latest ./test_gemfile.sh - - name: deploy docker - if: ${{ success() }} && - github.ref == 'refs/heads/master' || - github.ref == 'refs/heads/develop' || - github.ref == 'refs/heads/custom_branch_name' - shell: bash - run: ./deploy_docker.sh - env: - DOCKER_PASS: ${{ secrets.DOCKER_PASS }} - DOCKER_USER: ${{ secrets.DOCKER_USER }} + - name: deploy docker + if: ${{ success() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/custom_branch_name') }} + shell: bash + run: | + set -euo pipefail + ./deploy_docker.sh + env: + DOCKER_PASS: ${{ secrets.DOCKER_PASS }} + DOCKER_USER: ${{ secrets.DOCKER_USER }} apptainer: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: '3.8.x' + runs-on: ubuntu-22.04 + permissions: + contents: read + id-token: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.11.x' + + - name: install apptainer + shell: bash + run: | + set -euo pipefail + sudo add-apt-repository -y ppa:apptainer/ppa + sudo apt update + sudo apt install -y apptainer + + - name: build apptainer + shell: bash + run: | + set -euo pipefail + apptainer build \ + OpenStudio-$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT.$OPENSTUDIO_SHA-Apptainer.sif \ + docker://nrel/openstudio:$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT - - name: install apptainer - shell: bash - run: | - sudo add-apt-repository -y ppa:apptainer/ppa - sudo apt update - sudo apt install -y apptainer + - uses: actions/upload-artifact@v4 + with: + name: apptainer-image + path: OpenStudio-${{ env.OPENSTUDIO_VERSION }}${{ env.OPENSTUDIO_VERSION_EXT }}.${{ env.OPENSTUDIO_SHA }}-Apptainer.sif - - name: build apptainer - shell: bash - run: | - apptainer build \ - OpenStudio-$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT.$OPENSTUDIO_SHA-Apptainer.sif \ - docker://nrel/openstudio:$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT - - - uses: actions/upload-artifact@v3 - with: - name: apptainer-image - path: OpenStudio-${{ env.OPENSTUDIO_VERSION }}${{ env.OPENSTUDIO_VERSION_EXT }}.${{ env.OPENSTUDIO_SHA }}-Apptainer.sif - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v3 - with: - aws-region: ${{ secrets.AWS_DEFAULT_REGION }} - role-to-assume: arn:aws:iam::471211731895:role/OpenStudioGitHubActionsRole - role-session-name: GitHubActions + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v3 + with: + aws-region: ${{ secrets.AWS_DEFAULT_REGION }} + role-to-assume: arn:aws:iam::471211731895:role/OpenStudioGitHubActionsRole + role-session-name: GitHubActions - - name: Upload artifacts to AWS S3 - uses: usualdesigner/s3-artifact-upload@main - with: - bucket-name: openstudio-builds - prefix: ${{env.OPENSTUDIO_VERSION}} - file: OpenStudio-${{ env.OPENSTUDIO_VERSION }}${{ env.OPENSTUDIO_VERSION_EXT }}.${{ env.OPENSTUDIO_SHA }}-Apptainer.sif + - name: Upload artifacts to AWS S3 + uses: usualdesigner/s3-artifact-upload@main + with: + bucket-name: openstudio-builds + prefix: ${{ env.OPENSTUDIO_VERSION }} + file: OpenStudio-${{ env.OPENSTUDIO_VERSION }}${{ env.OPENSTUDIO_VERSION_EXT }}.${{ env.OPENSTUDIO_SHA }}-Apptainer.sif \ No newline at end of file From 13b19f75c27f913af52a0d01af104c6f601b8623 Mon Sep 17 00:00:00 2001 From: anchapin Date: Wed, 19 Nov 2025 10:19:56 -0500 Subject: [PATCH 11/20] Remove trailing newline at the end of the GitHub Actions workflow file --- .github/workflows/docker-openstudio.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docker-openstudio.yml b/.github/workflows/docker-openstudio.yml index 4b17622..142e047 100644 --- a/.github/workflows/docker-openstudio.yml +++ b/.github/workflows/docker-openstudio.yml @@ -98,4 +98,3 @@ jobs: bucket-name: openstudio-builds prefix: ${{ env.OPENSTUDIO_VERSION }} file: OpenStudio-${{ env.OPENSTUDIO_VERSION }}${{ env.OPENSTUDIO_VERSION_EXT }}.${{ env.OPENSTUDIO_SHA }}-Apptainer.sif - \ No newline at end of file From 21f3a5029346660996b251467e6abc5989393496 Mon Sep 17 00:00:00 2001 From: anchapin Date: Wed, 19 Nov 2025 10:47:41 -0500 Subject: [PATCH 12/20] Fix CI: Update to ubuntu-24.04 and skip apptainer on PRs --- .github/workflows/docker-openstudio.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-openstudio.yml b/.github/workflows/docker-openstudio.yml index 6046cb8..7317366 100644 --- a/.github/workflows/docker-openstudio.yml +++ b/.github/workflows/docker-openstudio.yml @@ -23,7 +23,7 @@ permissions: jobs: docker: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 @@ -54,7 +54,9 @@ jobs: DOCKER_USER: ${{ secrets.DOCKER_USER }} apptainer: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 + needs: docker + if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/custom_branch_name' }} permissions: contents: read id-token: write From 6e85468d74a6beb36cbbd33522d27fa06b6a01da Mon Sep 17 00:00:00 2001 From: anchapin Date: Wed, 19 Nov 2025 10:48:32 -0500 Subject: [PATCH 13/20] Fix: Revert OpenStudio version to 3.10.0 and remove version extension --- .github/workflows/docker-openstudio.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-openstudio.yml b/.github/workflows/docker-openstudio.yml index 7317366..5407446 100644 --- a/.github/workflows/docker-openstudio.yml +++ b/.github/workflows/docker-openstudio.yml @@ -14,9 +14,9 @@ concurrency: env: USE_TESTING_TIMEOUTS: "true" - OPENSTUDIO_VERSION: 3.11.0 + OPENSTUDIO_VERSION: 3.10.0 OPENSTUDIO_SHA: c7f13ad - OPENSTUDIO_VERSION_EXT: "-alpha" + OPENSTUDIO_VERSION_EXT: "" permissions: contents: read From 6e9921a649f9d9f762f2c2c19a416e40e0b3aee5 Mon Sep 17 00:00:00 2001 From: anchapin Date: Wed, 19 Nov 2025 11:05:42 -0500 Subject: [PATCH 14/20] Fix Dockerfile: Simplify OpenStudio folder assignment and echo statements --- Dockerfile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index f35d40f..4703bcd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -55,13 +55,11 @@ RUN curl -SLO -k https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.2.tar.gz \ #the folder will be Openstudio-3.9.0 or something like Openstudio-3.9.0-alpha RUN if [ -d "/usr/local/openstudio-${OPENSTUDIO_VERSION}" ]; then \ - echo "OpenStudio folder is /usr/local/openstudio-${OPENSTUDIO_VERSION}"; \ - OPENSTUDIO_FOLDER=/usr/local/openstudio-${OPENSTUDIO_VERSION}; \ + OPENSTUDIO_FOLDER=/usr/local/openstudio-${OPENSTUDIO_VERSION}; \ else \ - echo "OpenStudio folder is /usr/local/openstudio-${OPENSTUDIO_VERSION}${OPENSTUDIO_VERSION_EXT}"; \ - OPENSTUDIO_FOLDER=/usr/local/openstudio-${OPENSTUDIO_VERSION}${OPENSTUDIO_VERSION_EXT}; \ - fi \ - && echo "OpenStudio folder is ${OPENSTUDIO_FOLDER}" \ + OPENSTUDIO_FOLDER=/usr/local/openstudio-${OPENSTUDIO_VERSION}${OPENSTUDIO_VERSION_EXT}; \ + fi; \ + echo "OpenStudio folder is ${OPENSTUDIO_FOLDER}" \ && rm -rf ruby* \ && gem install bundler -v $OS_BUNDLER_VERSION \ && gem install zip \ @@ -69,7 +67,7 @@ RUN if [ -d "/usr/local/openstudio-${OPENSTUDIO_VERSION}" ]; then \ && ls /usr/local \ && cp ${OPENSTUDIO_FOLDER}/Ruby/Gemfile /var/oscli/ \ && cp ${OPENSTUDIO_FOLDER}/Ruby/Gemfile.lock /var/oscli/ \ - && cp ${OPENSTUDIO_FOLDER}/Ruby/openstudio-gems.gemspec /var/oscli/\ + && cp ${OPENSTUDIO_FOLDER}/Ruby/openstudio-gems.gemspec /var/oscli/ \ && ln -s ${OPENSTUDIO_FOLDER} /usr/local/openstudio-${OPENSTUDIO_VERSION} ENV RUBYLIB=/usr/local/openstudio-${OPENSTUDIO_VERSION}/Ruby From d9e8ce7525abe5c774295d25d89e2b681a315e84 Mon Sep 17 00:00:00 2001 From: anchapin Date: Wed, 19 Nov 2025 11:24:07 -0500 Subject: [PATCH 15/20] Update OpenStudio version to 3.11.0 and set version extension to alpha in CI workflow and Dockerfile --- .github/workflows/docker-openstudio.yml | 4 ++-- Dockerfile | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker-openstudio.yml b/.github/workflows/docker-openstudio.yml index 5407446..38d8218 100644 --- a/.github/workflows/docker-openstudio.yml +++ b/.github/workflows/docker-openstudio.yml @@ -14,9 +14,9 @@ concurrency: env: USE_TESTING_TIMEOUTS: "true" - OPENSTUDIO_VERSION: 3.10.0 + OPENSTUDIO_VERSION: 3.11.0 OPENSTUDIO_SHA: c7f13ad - OPENSTUDIO_VERSION_EXT: "" + OPENSTUDIO_VERSION_EXT: "alpha" permissions: contents: read diff --git a/Dockerfile b/Dockerfile index 4703bcd..2ca384b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -54,12 +54,12 @@ RUN curl -SLO -k https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.2.tar.gz \ #the folder will be Openstudio-3.9.0 or something like Openstudio-3.9.0-alpha -RUN if [ -d "/usr/local/openstudio-${OPENSTUDIO_VERSION}" ]; then \ - OPENSTUDIO_FOLDER=/usr/local/openstudio-${OPENSTUDIO_VERSION}; \ +RUN OPENSTUDIO_FOLDER=$(if [ -d "/usr/local/openstudio-${OPENSTUDIO_VERSION}" ]; then \ + echo "/usr/local/openstudio-${OPENSTUDIO_VERSION}"; \ else \ - OPENSTUDIO_FOLDER=/usr/local/openstudio-${OPENSTUDIO_VERSION}${OPENSTUDIO_VERSION_EXT}; \ - fi; \ - echo "OpenStudio folder is ${OPENSTUDIO_FOLDER}" \ + echo "/usr/local/openstudio-${OPENSTUDIO_VERSION}${OPENSTUDIO_VERSION_EXT}"; \ + fi) \ + && echo "OpenStudio folder is ${OPENSTUDIO_FOLDER}" \ && rm -rf ruby* \ && gem install bundler -v $OS_BUNDLER_VERSION \ && gem install zip \ From 9c882aadb251b66b276c690f6277f38ba1620720 Mon Sep 17 00:00:00 2001 From: anchapin Date: Wed, 19 Nov 2025 11:32:58 -0500 Subject: [PATCH 16/20] Refactor OpenStudio folder detection logic in Dockerfile for improved clarity and maintainability --- Dockerfile | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2ca384b..94cdb38 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,16 +49,11 @@ RUN curl -SLO -k https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.2.tar.gz \ && ./configure \ && make && make install -## if the openstudio-${OPENSTUDIO_VERSION} folder existed, set it as the OPENSTUDIO -## folder, otherwise set the openstudio-${OPENSTUDIO_VERSION}${OPENSTUDIO_VERSION_EXT} folder +## Detect the OpenStudio installation folder +## The folder will be openstudio-3.9.0 or something like openstudio-3.9.0-alpha +## We search for any folder matching the version pattern to handle various naming conventions -#the folder will be Openstudio-3.9.0 or something like Openstudio-3.9.0-alpha - -RUN OPENSTUDIO_FOLDER=$(if [ -d "/usr/local/openstudio-${OPENSTUDIO_VERSION}" ]; then \ - echo "/usr/local/openstudio-${OPENSTUDIO_VERSION}"; \ - else \ - echo "/usr/local/openstudio-${OPENSTUDIO_VERSION}${OPENSTUDIO_VERSION_EXT}"; \ - fi) \ +RUN OPENSTUDIO_FOLDER=$(find /usr/local -maxdepth 1 -type d -name "openstudio-${OPENSTUDIO_VERSION}*" | head -1) \ && echo "OpenStudio folder is ${OPENSTUDIO_FOLDER}" \ && rm -rf ruby* \ && gem install bundler -v $OS_BUNDLER_VERSION \ From fb6f444dca60d88c2c9d880c53627c25b1b1c43c Mon Sep 17 00:00:00 2001 From: anchapin Date: Wed, 19 Nov 2025 11:41:45 -0500 Subject: [PATCH 17/20] Enhance OpenStudio folder detection in Dockerfile with improved error handling and logging --- Dockerfile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 94cdb38..c8fbf13 100644 --- a/Dockerfile +++ b/Dockerfile @@ -53,13 +53,22 @@ RUN curl -SLO -k https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.2.tar.gz \ ## The folder will be openstudio-3.9.0 or something like openstudio-3.9.0-alpha ## We search for any folder matching the version pattern to handle various naming conventions -RUN OPENSTUDIO_FOLDER=$(find /usr/local -maxdepth 1 -type d -name "openstudio-${OPENSTUDIO_VERSION}*" | head -1) \ +RUN echo "Searching for OpenStudio installation..." \ + && ls -la /usr/local \ + && ls -la /usr \ + && OPENSTUDIO_FOLDER=$(find /usr -maxdepth 2 -type d -name "openstudio-${OPENSTUDIO_VERSION}*" 2>/dev/null | head -1) \ + && if [ -z "$OPENSTUDIO_FOLDER" ]; then \ + echo "ERROR: OpenStudio folder not found matching pattern openstudio-${OPENSTUDIO_VERSION}*"; \ + echo "Searching for any openstudio folder..."; \ + find /usr -maxdepth 2 -type d -name "openstudio-*" 2>/dev/null; \ + exit 1; \ + fi \ && echo "OpenStudio folder is ${OPENSTUDIO_FOLDER}" \ + && ls -la ${OPENSTUDIO_FOLDER} \ && rm -rf ruby* \ && gem install bundler -v $OS_BUNDLER_VERSION \ && gem install zip \ && mkdir /var/oscli \ - && ls /usr/local \ && cp ${OPENSTUDIO_FOLDER}/Ruby/Gemfile /var/oscli/ \ && cp ${OPENSTUDIO_FOLDER}/Ruby/Gemfile.lock /var/oscli/ \ && cp ${OPENSTUDIO_FOLDER}/Ruby/openstudio-gems.gemspec /var/oscli/ \ From f102e0f162fb5aaae67f9cca5bb395d309cba4e4 Mon Sep 17 00:00:00 2001 From: anchapin Date: Wed, 19 Nov 2025 12:06:43 -0500 Subject: [PATCH 18/20] ci: set OpenStudio 3.11.0-alpha download URL and improve deploy tagging --- .github/workflows/docker-openstudio.yml | 5 ++-- Dockerfile | 39 ++++++++++++++++--------- README.md | 28 ++++++++++++++++++ deploy_docker.sh | 20 +++++++++---- 4 files changed, 71 insertions(+), 21 deletions(-) diff --git a/.github/workflows/docker-openstudio.yml b/.github/workflows/docker-openstudio.yml index 38d8218..48b40c6 100644 --- a/.github/workflows/docker-openstudio.yml +++ b/.github/workflows/docker-openstudio.yml @@ -15,8 +15,9 @@ concurrency: env: USE_TESTING_TIMEOUTS: "true" OPENSTUDIO_VERSION: 3.11.0 - OPENSTUDIO_SHA: c7f13ad - OPENSTUDIO_VERSION_EXT: "alpha" + OPENSTUDIO_SHA: c7f13ad615 + OPENSTUDIO_VERSION_EXT: "-alpha" + OPENSTUDIO_DOWNLOAD_URL: "https://openstudio-ci-builds.s3-us-west-2.amazonaws.com/develop/OpenStudio-3.11.0-alpha%2Bc7f13ad615-Ubuntu-22.04-x86_64.deb" permissions: contents: read diff --git a/Dockerfile b/Dockerfile index c8fbf13..48353dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,10 @@ MAINTAINER Nicholas Long nicholas.long@nrel.gov # Set the version of OpenStudio when building the container. For example `docker build --build-arg ARG OPENSTUDIO_VERSION=3.10.0 ARG OPENSTUDIO_VERSION_EXT="-alpha" -ARG OPENSTUDIO_DOWNLOAD_URL="https://openstudio-ci-builds.s3.amazonaws.com/develop/OpenStudio-3.10.0-alpha%2B83cec57525-Ubuntu-22.04-x86_64.deb" +ARG OPENSTUDIO_SHA="" +# If OPENSTUDIO_DOWNLOAD_URL is not provided, construct a reasonable default using the +# OpenStudio CI S3 pattern. Users can override by passing --build-arg OPENSTUDIO_DOWNLOAD_URL=... +ARG OPENSTUDIO_DOWNLOAD_URL="" ENV RC_RELEASE=TRUE ENV OS_BUNDLER_VERSION=2.4.10 ENV RUBY_VERSION=3.2.2 @@ -17,19 +20,27 @@ ENV BUNDLE_WITHOUT=native_ext # install locales and set to en_US.UTF-8. This is needed for running the CLI on some machines # such as singularity. RUN apt-get update && apt-get install -y \ - curl \ - gdebi-core \ - libsqlite3-dev \ - libssl-dev \ - libffi-dev \ - build-essential \ - zlib1g-dev \ - vim \ - git \ - locales \ - sudo \ - && echo "OpenStudio Package Download URL is ${OPENSTUDIO_DOWNLOAD_URL}" \ - && curl -SLO $OPENSTUDIO_DOWNLOAD_URL \ + curl \ + gdebi-core \ + libsqlite3-dev \ + libssl-dev \ + libffi-dev \ + build-essential \ + zlib1g-dev \ + vim \ + git \ + locales \ + sudo \ + && if [ -z "${OPENSTUDIO_DOWNLOAD_URL}" ]; then \ + ESC_VERSION=$(echo "${OPENSTUDIO_VERSION}${OPENSTUDIO_VERSION_EXT}" | sed 's/+/%2B/g'); \ + if [ -n "${OPENSTUDIO_SHA}" ]; then \ + OPENSTUDIO_DOWNLOAD_URL="https://openstudio-ci-builds.s3.amazonaws.com/develop/OpenStudio-${ESC_VERSION}%2B${OPENSTUDIO_SHA}-Ubuntu-22.04-x86_64.deb"; \ + else \ + OPENSTUDIO_DOWNLOAD_URL="https://openstudio-ci-builds.s3.amazonaws.com/develop/OpenStudio-${ESC_VERSION}-Ubuntu-22.04-x86_64.deb"; \ + fi; \ + fi \ + && echo "OpenStudio Package Download URL is ${OPENSTUDIO_DOWNLOAD_URL}" \ + && curl -SLO "$OPENSTUDIO_DOWNLOAD_URL" \ && OPENSTUDIO_DOWNLOAD_FILENAME=$(ls *.deb) \ # Verify that the download was successful (not access denied XML from s3) && grep -v -q "AccessDenied" ${OPENSTUDIO_DOWNLOAD_FILENAME} \ diff --git a/README.md b/README.md index c22be36..300ae1a 100644 --- a/README.md +++ b/README.md @@ -85,3 +85,31 @@ If gem dependencies are required as part of the CLI outside of those # Issues Please submit issues on the project's [Github](https://github.com/nrel/docker-openstudio) page. + +## Building and publishing specific OpenStudio versions + + - **Local build for a specific version (example: 3.11.0-alpha):** + +```bash +docker build -t openstudio:latest \ + --build-arg OPENSTUDIO_VERSION=3.11.0 \ + --build-arg OPENSTUDIO_VERSION_EXT="-alpha" \ + --build-arg OPENSTUDIO_SHA= . +``` + +- **Tag and push locally (optional):** + +```bash +docker tag openstudio:latest yourrepo/openstudio:3.11.0-alpha +docker push yourrepo/openstudio:3.11.0-alpha +``` + +- **Trigger GitHub Actions build to publish to Docker Hub:** + + - Update `.github/workflows/docker-openstudio.yml` env values for `OPENSTUDIO_VERSION`, `OPENSTUDIO_VERSION_EXT`, and `OPENSTUDIO_SHA` on a branch. + - Create a pull request to `develop` and merge; the workflow will build and, if on `develop`, push the image to Docker Hub as the `develop` tag (and `latest`). + +Notes: + +- The `deploy_docker.sh` script tags images pushed to Docker Hub. You can override `DOCKER_REPO` for testing private repos. +- If `OPENSTUDIO_SHA` is empty, the downloader will attempt to use a generic S3 URL without the SHA. diff --git a/deploy_docker.sh b/deploy_docker.sh index 0de97fa..7678af1 100755 --- a/deploy_docker.sh +++ b/deploy_docker.sh @@ -1,7 +1,8 @@ #!/usr/bin/env bash IMAGETAG=${OPENSTUDIO_VERSION}${OPENSTUDIO_VERSION_EXT} -echo "image would be tagged as $IMAGETAG if this were master branch" +echo "default image tag would be $IMAGETAG" IMAGETAG=skip +DOCKER_REPO=${DOCKER_REPO:-nrel/openstudio} # Check branch name for correct tagging if [ "${GITHUB_REF}" == "refs/heads/develop" ]; then @@ -29,12 +30,21 @@ fi # GITHUB_BASE_REF is only set on Pull Request events. Do not build those if [ "${IMAGETAG}" != "skip" ] && [[ -z "${GITHUB_BASE_REF}" ]]; then - echo "Tagging image as $IMAGETAG" + echo "Tagging image as $IMAGETAG and pushing to ${DOCKER_REPO}" echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin - docker tag openstudio:latest nrel/openstudio:$IMAGETAG; (( exit_status = exit_status || $? )) - docker tag openstudio:latest nrel/openstudio:latest; (( exit_status = exit_status || $? )) - docker push nrel/openstudio:$IMAGETAG; (( exit_status = exit_status || $? )) + # Tag versioned image + docker tag openstudio:latest ${DOCKER_REPO}:$IMAGETAG; (( exit_status = exit_status || $? )) + # Always update latest + docker tag openstudio:latest ${DOCKER_REPO}:latest; (( exit_status = exit_status || $? )) + + # Push versioned tag + docker push ${DOCKER_REPO}:$IMAGETAG; (( exit_status = exit_status || $? )) + # If on develop branch, also push the develop tag pointing to this image + if [ "${IMAGETAG}" == "develop" ] || [ "${GITHUB_REF}" == "refs/heads/develop" ]; then + docker tag openstudio:latest ${DOCKER_REPO}:develop; (( exit_status = exit_status || $? )) + docker push ${DOCKER_REPO}:develop; (( exit_status = exit_status || $? )) + fi exit $exit_status else From 0ce84ee8c5a4d95d1215e0a6c63c3c216aff765a Mon Sep 17 00:00:00 2001 From: Assistant Bot Date: Wed, 26 Nov 2025 23:59:11 -0500 Subject: [PATCH 19/20] ci: update deploy script to conditionally push 'latest' tag for stable releases only --- deploy_docker.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/deploy_docker.sh b/deploy_docker.sh index 7678af1..8490e1a 100755 --- a/deploy_docker.sh +++ b/deploy_docker.sh @@ -35,8 +35,15 @@ if [ "${IMAGETAG}" != "skip" ] && [[ -z "${GITHUB_BASE_REF}" ]]; then echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin # Tag versioned image docker tag openstudio:latest ${DOCKER_REPO}:$IMAGETAG; (( exit_status = exit_status || $? )) - # Always update latest - docker tag openstudio:latest ${DOCKER_REPO}:latest; (( exit_status = exit_status || $? )) + + # Only update and push 'latest' if this is a stable release (no extension) + if [ -z "${OPENSTUDIO_VERSION_EXT}" ]; then + echo "Stable release detected. Updating and pushing '${DOCKER_REPO}:latest'" + docker tag openstudio:latest ${DOCKER_REPO}:latest; (( exit_status = exit_status || $? )) + docker push ${DOCKER_REPO}:latest; (( exit_status = exit_status || $? )) + else + echo "Pre-release detected (extension: '${OPENSTUDIO_VERSION_EXT}'). Skipping 'latest' tag update." + fi # Push versioned tag docker push ${DOCKER_REPO}:$IMAGETAG; (( exit_status = exit_status || $? )) From 1cf342bb6e41cb4d7887df0e0003c6c8382e3e4e Mon Sep 17 00:00:00 2001 From: Assistant Bot Date: Thu, 4 Dec 2025 14:49:48 -0500 Subject: [PATCH 20/20] revised version, sha, ext, download_url, and python version to match that of 3.11.0-rc1 --- .github/workflows/docker-openstudio.yml | 10 ++--- Dockerfile | 58 ++++++++++++------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/workflows/docker-openstudio.yml b/.github/workflows/docker-openstudio.yml index 48b40c6..ceb18f5 100644 --- a/.github/workflows/docker-openstudio.yml +++ b/.github/workflows/docker-openstudio.yml @@ -15,9 +15,9 @@ concurrency: env: USE_TESTING_TIMEOUTS: "true" OPENSTUDIO_VERSION: 3.11.0 - OPENSTUDIO_SHA: c7f13ad615 - OPENSTUDIO_VERSION_EXT: "-alpha" - OPENSTUDIO_DOWNLOAD_URL: "https://openstudio-ci-builds.s3-us-west-2.amazonaws.com/develop/OpenStudio-3.11.0-alpha%2Bc7f13ad615-Ubuntu-22.04-x86_64.deb" + OPENSTUDIO_SHA: dee62bf9dd + OPENSTUDIO_VERSION_EXT: "-rc1" + 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" permissions: contents: read @@ -29,7 +29,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.11.x' + python-version: '3.12.x' - name: test and build shell: bash @@ -65,7 +65,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.11.x' + python-version: '3.12.x' - name: install apptainer shell: bash diff --git a/Dockerfile b/Dockerfile index 48353dc..a753137 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ FROM ubuntu:22.04 AS base -MAINTAINER Nicholas Long nicholas.long@nrel.gov +LABEL maintainer="Nicholas Long nicholas.long@nrel.gov" # Set the version of OpenStudio when building the container. For example `docker build --build-arg -ARG OPENSTUDIO_VERSION=3.10.0 -ARG OPENSTUDIO_VERSION_EXT="-alpha" -ARG OPENSTUDIO_SHA="" +ARG OPENSTUDIO_VERSION=3.11.0 +ARG OPENSTUDIO_VERSION_EXT="-rc1" +ARG OPENSTUDIO_SHA="dee62bf9dd" # If OPENSTUDIO_DOWNLOAD_URL is not provided, construct a reasonable default using the # OpenStudio CI S3 pattern. Users can override by passing --build-arg OPENSTUDIO_DOWNLOAD_URL=... ARG OPENSTUDIO_DOWNLOAD_URL="" @@ -20,27 +20,27 @@ ENV BUNDLE_WITHOUT=native_ext # install locales and set to en_US.UTF-8. This is needed for running the CLI on some machines # such as singularity. RUN apt-get update && apt-get install -y \ - curl \ - gdebi-core \ - libsqlite3-dev \ - libssl-dev \ - libffi-dev \ - build-essential \ - zlib1g-dev \ - vim \ - git \ - locales \ - sudo \ - && if [ -z "${OPENSTUDIO_DOWNLOAD_URL}" ]; then \ - ESC_VERSION=$(echo "${OPENSTUDIO_VERSION}${OPENSTUDIO_VERSION_EXT}" | sed 's/+/%2B/g'); \ - if [ -n "${OPENSTUDIO_SHA}" ]; then \ - OPENSTUDIO_DOWNLOAD_URL="https://openstudio-ci-builds.s3.amazonaws.com/develop/OpenStudio-${ESC_VERSION}%2B${OPENSTUDIO_SHA}-Ubuntu-22.04-x86_64.deb"; \ - else \ - OPENSTUDIO_DOWNLOAD_URL="https://openstudio-ci-builds.s3.amazonaws.com/develop/OpenStudio-${ESC_VERSION}-Ubuntu-22.04-x86_64.deb"; \ - fi; \ - fi \ - && echo "OpenStudio Package Download URL is ${OPENSTUDIO_DOWNLOAD_URL}" \ - && curl -SLO "$OPENSTUDIO_DOWNLOAD_URL" \ + curl \ + gdebi-core \ + libsqlite3-dev \ + libssl-dev \ + libffi-dev \ + build-essential \ + zlib1g-dev \ + vim \ + git \ + locales \ + sudo \ + && if [ -z "${OPENSTUDIO_DOWNLOAD_URL}" ]; then \ + ESC_VERSION=$(echo "${OPENSTUDIO_VERSION}${OPENSTUDIO_VERSION_EXT}" | sed 's/+/%2B/g'); \ + if [ -n "${OPENSTUDIO_SHA}" ]; then \ + OPENSTUDIO_DOWNLOAD_URL="https://openstudio-ci-builds.s3.amazonaws.com/develop/OpenStudio-${ESC_VERSION}%2B${OPENSTUDIO_SHA}-Ubuntu-22.04-x86_64.deb"; \ + else \ + OPENSTUDIO_DOWNLOAD_URL="https://openstudio-ci-builds.s3.amazonaws.com/develop/OpenStudio-${ESC_VERSION}-Ubuntu-22.04-x86_64.deb"; \ + fi; \ + fi \ + && echo "OpenStudio Package Download URL is ${OPENSTUDIO_DOWNLOAD_URL}" \ + && curl -SLO "$OPENSTUDIO_DOWNLOAD_URL" \ && OPENSTUDIO_DOWNLOAD_FILENAME=$(ls *.deb) \ # Verify that the download was successful (not access denied XML from s3) && grep -v -q "AccessDenied" ${OPENSTUDIO_DOWNLOAD_FILENAME} \ @@ -69,10 +69,10 @@ RUN echo "Searching for OpenStudio installation..." \ && ls -la /usr \ && OPENSTUDIO_FOLDER=$(find /usr -maxdepth 2 -type d -name "openstudio-${OPENSTUDIO_VERSION}*" 2>/dev/null | head -1) \ && if [ -z "$OPENSTUDIO_FOLDER" ]; then \ - echo "ERROR: OpenStudio folder not found matching pattern openstudio-${OPENSTUDIO_VERSION}*"; \ - echo "Searching for any openstudio folder..."; \ - find /usr -maxdepth 2 -type d -name "openstudio-*" 2>/dev/null; \ - exit 1; \ + echo "ERROR: OpenStudio folder not found matching pattern openstudio-${OPENSTUDIO_VERSION}*"; \ + echo "Searching for any openstudio folder..."; \ + find /usr -maxdepth 2 -type d -name "openstudio-*" 2>/dev/null; \ + exit 1; \ fi \ && echo "OpenStudio folder is ${OPENSTUDIO_FOLDER}" \ && ls -la ${OPENSTUDIO_FOLDER} \