Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge devel to master for release 5.2 #102

Merged
merged 22 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b2a4d7e
Add locking around instance creation
kjsanger Nov 17, 2023
7e23f26
Merge pull request #89 from kjsanger/feature/singularity-instance-lock
jmtcsngr Nov 28, 2023
c9d338e
Add action to build and upload bundle on release
mksanger Jan 10, 2024
8100cfd
Add libnss shared objects to bundle
mksanger Jan 16, 2024
608795f
Upload bundle to release
mksanger Jan 16, 2024
3a8adef
Update step names to match name convention
mksanger Jan 18, 2024
ea0e78d
Allow name and prerelease determining variables to be picked up by cr…
mksanger Jan 18, 2024
2328f7f
Add separate `preRelease` output from `release_variable` step because…
mksanger Jan 19, 2024
b6b3664
Merge pull request #92 from mksanger/add_exodus_actions
kjsanger Jan 24, 2024
e3d4ed1
upgrade actions checkout to v4
jmtcsngr Feb 28, 2024
2c75b61
Create dependabot.yml
kjsanger Feb 29, 2024
1836dd7
Bump ncipollo/release-action from 1.12.0 to 1.14.0
dependabot[bot] Feb 29, 2024
35a4f13
Bump actions/download-artifact from 3 to 4
dependabot[bot] Feb 29, 2024
4a3ac53
Bump docker/setup-buildx-action from 2 to 3
dependabot[bot] Feb 29, 2024
42f8638
Bump docker/login-action from 2 to 3
dependabot[bot] Feb 29, 2024
df3e529
Bump jlumbroso/free-disk-space from 1.3.0 to 1.3.1
dependabot[bot] Feb 29, 2024
801b8a7
Merge pull request #98 from wtsi-npg/dependabot/github_actions/jlumbr…
kjsanger Feb 29, 2024
8d8a63b
Merge pull request #97 from wtsi-npg/dependabot/github_actions/docker…
kjsanger Feb 29, 2024
70d16dc
Merge pull request #96 from wtsi-npg/dependabot/github_actions/docker…
kjsanger Feb 29, 2024
aadac70
Merge pull request #95 from wtsi-npg/dependabot/github_actions/action…
kjsanger Feb 29, 2024
8a26ea1
Merge pull request #94 from wtsi-npg/dependabot/github_actions/ncipol…
kjsanger Feb 29, 2024
401a069
Merge pull request #93 from jmtcsngr/checkoutv4
kjsanger Mar 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
89 changes: 72 additions & 17 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,21 @@ on:
tags:
- "*"

env:
BUNDLE_NAME: bundle-ub-16.04-irods-clients-4.2.7.tgz

jobs:
release:

release_variables:
runs-on: ubuntu-latest

defaults:
run:
shell: bash -l -e -o pipefail {0}

steps:
- name: "Checkout code"
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -24,36 +28,31 @@ jobs:
run: |
# Avoid git exiting when Actions runs
git config --global --add safe.directory "$PWD"

git fetch --tags --force

- name: "Get release variables"
run: |
echo 'RELEASE_VERSION='$(git describe --always --tags) >> $GITHUB_ENV
echo 'MASTER_SHA='$(git rev-parse origin/master) >> $GITHUB_ENV

- name: "Create Release"
uses: ncipollo/release-action@v1.12.0
with:
name: ${{ env.RELEASE_VERSION }}
prerelease: ${{ !(github.sha == env.MASTER_SHA) }}
generateReleaseNotes: true

outputs:
isRelease: ${{ github.sha == env.MASTER_SHA }}
preRelease: ${{ !(github.sha == env.MASTER_SHA) }}
releaseVersion: ${{ env.RELEASE_VERSION }}

deploy:
runs-on: ubuntu-latest

needs: release
needs: release_variables

# Workaround for https://github.com/actions/runner/issues/1483
# Actions coerces boolean to string
if: needs.release.outputs.isRelease == 'true'
if: needs.release_variables.outputs.isRelease == 'true'

steps:
- name: "Free disk space on the runner"
uses: jlumbroso/free-disk-space@f68fdb76e2ea636224182cfb7377ff9a1708f9b8 # v1.3.0
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
with:
tool-cache: false
android: true
Expand All @@ -64,7 +63,7 @@ jobs:
swap-storage: false

- name: "Checkout code"
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -77,12 +76,12 @@ jobs:
git fetch --tags --force

- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug

- name: "Login to ghcr.io"
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
Expand All @@ -103,3 +102,59 @@ jobs:
docker images

make push GITHUB_ACTIONS=${GITHUB_ACTIONS} GITHUB_REPOSITORY_OWNER=${{ github.repository_owner }}

bundle:
runs-on: ubuntu-latest
container: "ghcr.io/wtsi-npg/ub-16.04-irods-clients-4.2.7:latest"

needs: deploy

if: always()

steps:
- name: "Install exodus"
run: |
apt-get update
apt-get install -q -y python3-pip
pip3 install exodus-bundler

- name: "Bundle clients"

run: exodus --tarball --add /usr/lib/irods/plugins/ --add /lib/x86_64-linux-gnu/ --output $BUNDLE_NAME /usr/local/bin/baton-* /usr/bin/ils /usr/bin/iinit /usr/bin/imeta

- name: "Upload bundle"
uses: actions/upload-artifact@v3
with:
name: client_bundle
path: ${{ env.BUNDLE_NAME }}

release:
runs-on: ubuntu-latest

needs: [release_variables, bundle]

if: always()

defaults:
run:
shell: bash -l -e -o pipefail {0}

steps:

- name: "Download artifact"
uses: actions/download-artifact@v4
with:
name: client_bundle

- name: "Create Release"
uses: ncipollo/release-action@v1.14.0
with:
name: ${{ env.NAME }}
prerelease: ${{ env.PRERELEASE }}
artifacts: ${{ env.BUNDLE_NAME }}
removeArtifacts: true
artifactErrorsFailBuild: true
generateReleaseNotes: true
env:
NAME: ${{ needs.release_variables.outputs.releaseVersion }}
PRERELEASE: ${{ needs.release_variables.outputs.preRelease }}
6 changes: 3 additions & 3 deletions .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

steps:
- name: "Checkout code"
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -31,12 +31,12 @@ jobs:
git fetch --tags --force

- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug

- name: "Login to ghcr.io"
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,22 @@ e.g. Install wrappers to $PREFIX/bin:
...
-rwxr-xr-x 1 kdj staff 409 Apr 12 15:47 samtools

# iRODS Client Bundle

The release contains irods 4.2.7 clients bundled from
`ub-16.04-irods-clients-4.2.7` to be used on ONT machines, where we
cannot run containers. Given the complexity of the iRODS clients'
dependency chain, the location of the plugins must be provided in the
iRODS environment file using the `irods_plugins_home` key. Some
dependencies for these plugins must also be preloaded to avoid local
system libraries from being pulled in, e.g.:

$ LD_PRELOAD=path/libarchive.so.16:path/libcrypto.so.1.0.0:path/libssl.so.1.0.0:path/libxml2.so.2:path/libicuuc.so.55:path/libicudata.so.55 \
./exodus/bin/iinit

A script to do this is set up by the ansible used to set up the instruments
(https://gitlab.internal.sanger.ac.uk/npg/oxford_nanopore_instruments).


## Author

Expand Down
41 changes: 37 additions & 4 deletions singularity/scripts/singularity-service-docker
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Running this script will start an instance of the container, if one is not
# Running this script will start an instance of the container, if one is not
# already running, and then execute the command in the instance.
#
# Cleaning up unwanted instances afterwards is outside the scope of this script.
Expand All @@ -11,12 +11,45 @@ DOCKER_USER=${DOCKER_USER:?required, but not set}
DOCKER_IMAGE=${DOCKER_IMAGE:?required, but was not set}
DOCKER_TAG=${DOCKER_TAG:?required, but not set}

DOCKER_URL="docker://$DOCKER_REGISTRY/$DOCKER_USER/$DOCKER_IMAGE:$DOCKER_TAG"

# Colons and slashes are not allowed in Singularity instance names
instance="$DOCKER_REGISTRY--$DOCKER_USER--$DOCKER_IMAGE--$DOCKER_TAG"

if ! singularity instance list | grep "$instance" 2>&1 | logger -p user.notice -t singularity-service-docker ; then
singularity instance start \
"docker://$DOCKER_REGISTRY/$DOCKER_USER/$DOCKER_IMAGE:$DOCKER_TAG" "$instance" 2>&1 | logger -p user.notice -t singularity-service-docker
# Requires bash >=4.1 for file descriptor management with "{<variable>}"
LOCK_FILE="/var/lock/$instance--$USER.lock"
LOCK_TIMEOUT=60

# Get the first free file descriptor
exec {FD}>"$LOCK_FILE"

# Release the lock and close the file descriptor
clean_up() {
flock --unlock $FD || {
echo >&2 "Failed to release lock on $LOCK_FILE (fd: $FD): $?"
}
exec {FD}>&-
}

clean_up_and_exit() {
clean_up
exit 1
}

# clean_up_and_exit on these signals
trap clean_up_and_exit SIGINT SIGTERM SIGUSR1 SIGUSR2

flock --exclusive --timeout $LOCK_TIMEOUT $FD || {
echo >&2 "Failed to obtain lock on $LOCK_FILE (fd: $FD): $?"
exit 1
}

if ! singularity instance list 2> >(logger -s -p user.err -t singularity-service-docker) |\
grep "$instance" 2>&1 >/dev/null
then
singularity --silent instance start "$DOCKER_URL" "$instance" 2> >(logger -s -p user.err -t singularity-service-docker) >/dev/null
fi

clean_up

singularity exec "instance://$instance" "$@"