Skip to content

Commit

Permalink
Merge pull request #175 from NREL/apptainer
Browse files Browse the repository at this point in the history
Apptainer Builds and upload s3 fix.
  • Loading branch information
wenyikuang authored Sep 4, 2024
2 parents ee1079f + 0d58708 commit a2881f2
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 12 deletions.
54 changes: 43 additions & 11 deletions .github/workflows/docker-openstudio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ env:
OPENSTUDIO_SHA: f953b6fcaf
OPENSTUDIO_VERSION_EXT: ""

permissions:
contents: read
id-token: write

jobs:
docker:
Expand Down Expand Up @@ -48,15 +51,44 @@ 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 }}
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: |
sudo add-apt-repository -y ppa:apptainer/ppa
sudo apt update
sudo apt install -y apptainer
- 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: 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

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ MAINTAINER Nicholas Long [email protected]

# 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
Expand Down

0 comments on commit a2881f2

Please sign in to comment.