diff --git a/.github/workflows/build_ghcr.yaml b/.github/workflows/build_ghcr.yaml index 8a63fe4..dded55e 100644 --- a/.github/workflows/build_ghcr.yaml +++ b/.github/workflows/build_ghcr.yaml @@ -16,6 +16,7 @@ jobs: matrix: ubuntu: [jammy] platform: [linux/amd64] + branch: [devel, release] name: Build container images for GHCR runs-on: ubuntu-latest @@ -62,6 +63,7 @@ jobs: id: build uses: docker/build-push-action@v4 with: + build-args: CYCLE=${{matrix.branch}} labels: ${{ steps.meta.outputs.labels }} outputs: type=image,name=${{ steps.vars.outputs.container }},push-by-digest=true,name-canonical=true,push=true platforms: ${{matrix.platform}} @@ -73,7 +75,7 @@ jobs: cat << "EOF" > ${{matrix.ubuntu}}-${{matrix.platform}}-r.Dockerfile FROM ${{ steps.vars.outputs.container }}@${{ steps.build.outputs.digest }} as extract USER root - RUN mkdir /bioctmp && /bbs_r_start --version > /bioctmp/rver && cat /etc/os-release > /bioctmp/os-release + RUN mkdir /bioctmp && /bbs_r_start -e 'BiocManager::version()' | grep '\[1\]' | awk -F"'" '{print $2}' > /bioctmp/biocver && /bbs_r_start --version > /bioctmp/rver && cat /etc/os-release > /bioctmp/os-release FROM scratch as export COPY --from=extract /bioctmp/* / EOF @@ -96,6 +98,7 @@ jobs: cd ${{matrix.ubuntu}}-${{matrix.platform}} tar -xvf r.tar echo rver=$(cat rver | awk 'NR==1{print $3}') >> $GITHUB_OUTPUT + echo biocver=$(cat biocver) >> $GITHUB_OUTPUT echo osver=$(awk -F= '/VERSION_ID/ {gsub("\"", "", $2); print $2}' os-release) >> $GITHUB_OUTPUT - name: Export digest by ubuntu and r versions @@ -103,12 +106,16 @@ jobs: digest="${{ steps.build.outputs.digest }}" mkdir -p /tmp/digests/${{matrix.ubuntu}} touch "/tmp/digests/${{matrix.ubuntu}}/${digest#sha256:}" - mkdir -p /tmp/digests/${{matrix.ubuntu}}-r-${{steps.versions.outputs.rver}} - touch "/tmp/digests/${{matrix.ubuntu}}-r-${{steps.versions.outputs.rver}}/${digest#sha256:}" + mkdir -p /tmp/digests/${{matrix.ubuntu}}-bioc-${{steps.versions.outputs.biocver}} + touch "/tmp/digests/${{matrix.ubuntu}}-bioc-${{steps.versions.outputs.biocver}}/${digest#sha256:}" + mkdir -p /tmp/digests/${{matrix.ubuntu}}-bioc-${{steps.versions.outputs.biocver}}-r-${{steps.versions.outputs.rver}} + touch "/tmp/digests/${{matrix.ubuntu}}-bioc-${{steps.versions.outputs.biocver}}-r-${{steps.versions.outputs.rver}}/${digest#sha256:}" mkdir -p /tmp/digests/${{steps.versions.outputs.osver}} touch "/tmp/digests/${{steps.versions.outputs.osver}}/${digest#sha256:}" - mkdir -p /tmp/digests/${{steps.versions.outputs.osver}}-r-${{steps.versions.outputs.rver}} - touch "/tmp/digests/${{steps.versions.outputs.osver}}-r-${{steps.versions.outputs.rver}}/${digest#sha256:}" + mkdir -p /tmp/digests/${{steps.versions.outputs.osver}}-bioc-${{steps.versions.outputs.biocver}} + touch "/tmp/digests/${{steps.versions.outputs.osver}}-bioc-${{steps.versions.outputs.biocver}}/${digest#sha256:}" + mkdir -p /tmp/digests/${{steps.versions.outputs.osver}}-bioc-${{steps.versions.outputs.biocver}}-r-${{steps.versions.outputs.rver}} + touch "/tmp/digests/${{steps.versions.outputs.osver}}-bioc-${{steps.versions.outputs.biocver}}-r-${{steps.versions.outputs.rver}}/${digest#sha256:}" - name: Upload digests uses: actions/upload-artifact@v3 diff --git a/Dockerfile b/Dockerfile index e537df1..24f1102 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,9 @@ FROM ubuntu:jammy +ARG CYCLE=release RUN useradd -ms /bin/bash biocbuild && apt update -qq && apt install sudo systemd -y && usermod -aG sudo biocbuild && echo "biocbuild ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers USER biocbuild COPY . /home/biocbuild/bioconductor_salt WORKDIR /home/biocbuild -RUN bash bioconductor_salt/simple_start_linux.sh +RUN bash bioconductor_salt/startup_bbs_standalone_${CYCLE}.sh ENTRYPOINT ["/bbs_r_start"] diff --git a/saltstack/pillar/custom/devel_standalone.sls b/saltstack/pillar/custom/devel_standalone.sls new file mode 100644 index 0000000..cc04044 --- /dev/null +++ b/saltstack/pillar/custom/devel_standalone.sls @@ -0,0 +1,13 @@ +{# Custom Settings #} + +{% set branch = 'devel' %} {# Use 'release' or 'devel' #} +{% set version = '3.19' %} +{% set environment = 'dev' %} {# Use 'dev' or 'prod' #} +{% set r_download = 'https://stat.ethz.ch/R/daily/R-devel.tar.gz' %} +{% set r_version = 'R-4.4' %} +{% set r_previous_version = 'R-4.3' %} +{% set cycle = 'patch' %} {# Use 'devel' for Spring to Fall, 'patch' for Fall to Spring #} +{% set name = 'bbs-machine' %} +{% set immunespace_pwd = '' %} +{% set create_users = False %} +{% set machine_type = 'standalone' %} diff --git a/saltstack/pillar/custom/standalone.sls b/saltstack/pillar/custom/release_standalone.sls similarity index 73% rename from saltstack/pillar/custom/standalone.sls rename to saltstack/pillar/custom/release_standalone.sls index 3a6b102..086211d 100644 --- a/saltstack/pillar/custom/standalone.sls +++ b/saltstack/pillar/custom/release_standalone.sls @@ -1,12 +1,12 @@ {# Custom Settings #} -{% set branch = 'devel' %} {# Use 'release' or 'devel' #} +{% set branch = 'release' %} {# Use 'release' or 'devel' #} {% set version = '3.18' %} {% set environment = 'dev' %} {# Use 'dev' or 'prod' #} -{% set r_download = 'https://cran.r-project.org/src/base/R-4/R-4.3.1.tar.gz' %} +{% set r_download = 'https://cran.r-project.org/src/base/R-4/R-4.3.2.tar.gz' %} {% set r_version = 'R-4.3' %} {% set r_previous_version = 'R-4.2' %} -{% set cycle = 'devel' %} {# Use 'devel' for Spring to Fall, 'patch' for Fall to Spring #} +{% set cycle = 'patch' %} {# Use 'devel' for Spring to Fall, 'patch' for Fall to Spring #} {% set name = 'bbs-machine' %} {% set immunespace_pwd = '' %} {% set create_users = False %} diff --git a/simple_start_linux.sh b/startup_bbs_standalone_devel.sh similarity index 95% rename from simple_start_linux.sh rename to startup_bbs_standalone_devel.sh index 4049982..08ae2e2 100644 --- a/simple_start_linux.sh +++ b/startup_bbs_standalone_devel.sh @@ -25,7 +25,7 @@ sudo cp -r bioconductor_salt/saltstack/salt /srv sudo cp -r bioconductor_salt/saltstack/pillar /srv sudo cp bioconductor_salt/saltstack/minion.d/minion.conf /etc/salt/minion -sudo mv /srv/pillar/custom/standalone.sls /srv/pillar/custom/init.sls +sudo mv /srv/pillar/custom/devel_standalone.sls /srv/pillar/custom/init.sls sudo salt-call --local state.highstate -l debug || true diff --git a/startup_bbs_standalone_release.sh b/startup_bbs_standalone_release.sh new file mode 100644 index 0000000..5049df7 --- /dev/null +++ b/startup_bbs_standalone_release.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +# Basic deps +sudo apt update -qq +sudo apt -y install curl git build-essential python3 python3-pip locales wget + +# Set up saltstack + +# https://docs.saltproject.io/salt/install-guide/en/latest/topics/install-by-operating-system/ubuntu.html + +sudo curl -fsSL -o /etc/apt/keyrings/salt-archive-keyring-2023.gpg https://repo.saltproject.io/salt/py3/ubuntu/22.04/amd64/SALT-PROJECT-GPG-PUBKEY-2023.gpg +echo "deb [signed-by=/etc/apt/keyrings/salt-archive-keyring-2023.gpg arch=amd64] https://repo.saltproject.io/salt/py3/ubuntu/22.04/amd64/latest jammy main" | sudo tee /etc/apt/sources.list.d/salt.list + +sudo apt-get -y update +sudo apt-get -y install salt-minion +sudo service salt-minion stop +sudo systemctl disable salt-minion + +# Assumes the repository has already been cloned to the working directory +# cd ~ +# git clone -b standalone https://github.com/Bioconductor/bioconductor_salt + +# Set up bioconductor's saltstack +sudo cp -r bioconductor_salt/saltstack/salt /srv +sudo cp -r bioconductor_salt/saltstack/pillar /srv +sudo cp bioconductor_salt/saltstack/minion.d/minion.conf /etc/salt/minion + +sudo mv /srv/pillar/custom/release_standalone.sls /srv/pillar/custom/init.sls + +sudo salt-call --local state.highstate -l debug || true + +# Find R path and check that it works +/home/biocbuild/bbs-*/R/bin/R --version > /tmp/rver +if ! grep -q 'R version' /tmp/rver; then exit 1; fi + +RPATH="$(echo /home/biocbuild/bbs-*/R/bin)" + +echo "export PATH='$PATH:$RPATH'" | sudo tee -a /etc/profile +echo "export PATH='$PATH:$RPATH'" | sudo tee -a /etc/bash.bashrc + +echo "#!/bin/bash" | sudo tee /bbs_r_start +echo "$RPATH/R \"\$@\"" | sudo tee -a /bbs_r_start + +sudo chown biocbuild /bbs_r_start +sudo chmod +x /bbs_r_start + +# Cleanup +# rm -rf /srv /etc/salt +# sudo apt-get -y purge salt-minion + +