From 1e67c51b38eefb80322e3ad517fa2246434dd1d7 Mon Sep 17 00:00:00 2001 From: Noel Merket Date: Fri, 10 Nov 2023 16:25:34 -0700 Subject: [PATCH 1/7] updating to apptainer --- .github/workflows/docker-openstudio.yml | 29 +++++++++++++++---------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docker-openstudio.yml b/.github/workflows/docker-openstudio.yml index ff45247..a54e195 100644 --- a/.github/workflows/docker-openstudio.yml +++ b/.github/workflows/docker-openstudio.yml @@ -48,15 +48,22 @@ jobs: DOCKER_PASS: ${{ secrets.DOCKER_PASS }} DOCKER_USER: ${{ secrets.DOCKER_USER }} - - name: deploy singularity - if: ${{ success() }} && - github.ref == 'refs/heads/master' || - github.ref == 'refs/heads/develop' || - github.ref == 'refs/heads/custom_brach_name' - shell: bash - run: ./singularity/deploy_singularity.sh - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} + - name: install apptainer + shell: bash + run: | + sudo add-apt-repository -y ppa:apptainer/ppa + sudo apt update + sudo apt install -y apptainer + - name: deploy apptainer + shell: bash + run: | + mkdir -p /artifacts + apptainer build \ + /artifacts/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: singularity-image + path: /artifacts/OpenStudio-$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT.$OPENSTUDIO_SHA-Apptainer.sif From ca714bf5780fc96a694379a4748e0d1966e52860 Mon Sep 17 00:00:00 2001 From: Noel Merket Date: Fri, 10 Nov 2023 16:36:01 -0700 Subject: [PATCH 2/7] renaming some workflow stuff --- .github/workflows/docker-openstudio.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-openstudio.yml b/.github/workflows/docker-openstudio.yml index a54e195..08bfbe3 100644 --- a/.github/workflows/docker-openstudio.yml +++ b/.github/workflows/docker-openstudio.yml @@ -55,7 +55,7 @@ jobs: sudo apt update sudo apt install -y apptainer - - name: deploy apptainer + - name: build apptainer shell: bash run: | mkdir -p /artifacts From 0765417deb706f767dd1158234aea62c2a8622c6 Mon Sep 17 00:00:00 2001 From: Noel Merket Date: Fri, 10 Nov 2023 16:37:21 -0700 Subject: [PATCH 3/7] and the other thing to rename --- .github/workflows/docker-openstudio.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-openstudio.yml b/.github/workflows/docker-openstudio.yml index 08bfbe3..e95c931 100644 --- a/.github/workflows/docker-openstudio.yml +++ b/.github/workflows/docker-openstudio.yml @@ -65,5 +65,5 @@ jobs: - uses: actions/upload-artifact@v3 with: - name: singularity-image + name: apptainer-image path: /artifacts/OpenStudio-$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT.$OPENSTUDIO_SHA-Apptainer.sif From c4857da36dcbdaa511d622964dcff012c64d76ed Mon Sep 17 00:00:00 2001 From: Noel Merket Date: Mon, 13 Nov 2023 11:16:32 -0700 Subject: [PATCH 4/7] upterm action --- .github/workflows/docker-openstudio.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/docker-openstudio.yml b/.github/workflows/docker-openstudio.yml index e95c931..371ae96 100644 --- a/.github/workflows/docker-openstudio.yml +++ b/.github/workflows/docker-openstudio.yml @@ -55,6 +55,11 @@ jobs: sudo apt update sudo apt install -y apptainer + - name: Upterm + uses: lhotari/action-upterm@v1 + with: + limit-access-to-users: nmerket + - name: build apptainer shell: bash run: | From 68e0739e6c8eb84512ded0c44d544fa4fcd4f026 Mon Sep 17 00:00:00 2001 From: Noel Merket Date: Mon, 13 Nov 2023 11:39:56 -0700 Subject: [PATCH 5/7] fixing path of apptainer build --- .github/workflows/docker-openstudio.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-openstudio.yml b/.github/workflows/docker-openstudio.yml index 371ae96..51bd4fd 100644 --- a/.github/workflows/docker-openstudio.yml +++ b/.github/workflows/docker-openstudio.yml @@ -55,20 +55,14 @@ jobs: sudo apt update sudo apt install -y apptainer - - name: Upterm - uses: lhotari/action-upterm@v1 - with: - limit-access-to-users: nmerket - - name: build apptainer shell: bash run: | - mkdir -p /artifacts apptainer build \ - /artifacts/OpenStudio-$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT.$OPENSTUDIO_SHA-Apptainer.sif \ + 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: /artifacts/OpenStudio-$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT.$OPENSTUDIO_SHA-Apptainer.sif + path: OpenStudio-$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT.$OPENSTUDIO_SHA-Apptainer.sif From 11a4b5242e19bef9ddf20e14cb39bf396aba4362 Mon Sep 17 00:00:00 2001 From: Noel Merket Date: Mon, 13 Nov 2023 12:09:20 -0700 Subject: [PATCH 6/7] fixing environment variable expansion --- .github/workflows/docker-openstudio.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-openstudio.yml b/.github/workflows/docker-openstudio.yml index 51bd4fd..8751687 100644 --- a/.github/workflows/docker-openstudio.yml +++ b/.github/workflows/docker-openstudio.yml @@ -65,4 +65,4 @@ jobs: - uses: actions/upload-artifact@v3 with: name: apptainer-image - path: OpenStudio-$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT.$OPENSTUDIO_SHA-Apptainer.sif + path: OpenStudio-${{ env.OPENSTUDIO_VERSION }}${{ env.OPENSTUDIO_VERSION_EXT }}.${{ env.OPENSTUDIO_SHA }}-Apptainer.sif From 0d587086484c1b6b8e39c99a7abd05de5104999b Mon Sep 17 00:00:00 2001 From: Wenyi Kuang Date: Wed, 4 Sep 2024 16:54:31 -0600 Subject: [PATCH 7/7] Set up aws role and upload to s3. --- .github/workflows/docker-openstudio.yml | 26 +++++++++++++++++++++++++ Dockerfile | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-openstudio.yml b/.github/workflows/docker-openstudio.yml index 829e4ea..b9e0785 100644 --- a/.github/workflows/docker-openstudio.yml +++ b/.github/workflows/docker-openstudio.yml @@ -14,6 +14,9 @@ env: OPENSTUDIO_SHA: f953b6fcaf OPENSTUDIO_VERSION_EXT: "" +permissions: + contents: read + id-token: write jobs: docker: @@ -48,6 +51,14 @@ jobs: 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' + - name: install apptainer shell: bash run: | @@ -66,3 +77,18 @@ jobs: 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: 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 diff --git a/Dockerfile b/Dockerfile index 9f4aefd..07453fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ 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.8.0 -ARG OPENSTUDIO_VERSION_EXT="" +ARG OPENSTUDIO_VERSION_EXT="f953b6fcaf" ARG OPENSTUDIO_DOWNLOAD_URL=https://openstudio-ci-builds.s3.amazonaws.com/develop/OpenStudio-3.8.0%2Bf953b6fcaf-Ubuntu-20.04-x86_64.deb ENV RC_RELEASE=TRUE ENV OS_BUNDLER_VERSION=2.4.10