From 53914cefe4578c1b0d0e0ff2f3a9116d36d6fd44 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Mon, 6 Jul 2020 19:29:45 +0200 Subject: [PATCH 01/31] add singularity guide --- README.md | 3 ++- .../README.md | 0 .../github-actions-runner-singularity.def | 25 ++++++++++++++++--- 3 files changed, 24 insertions(+), 4 deletions(-) rename {ubuntu-slurm => ubuntu-singularity}/README.md (100%) rename ubuntu-slurm/ga-runner-singularity.def => ubuntu-singularity/github-actions-runner-singularity.def (58%) diff --git a/README.md b/README.md index 0ae0c8c..5bbc512 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,8 @@ Linux Ubuntu. | Status | Client OS | Server hardware | Runner | Additional functionality | | --- | --- | --- | --- | --- | -| :heavy_check_mark: Completed | Linux Ubuntu | local machine via Docker | - | | +| :heavy_check_mark: Completed | Linux Ubuntu | local machine via Docker | [link](/ubuntu-docker/README.md) | | +| :heavy_check_mark: Completed | Linux Ubuntu | local machine via Singularity | [link](/ubuntu-singularity/README.md) | | | :heavy_check_mark: Completed | Linux Ubuntu | local machine via Vagrant | [link](/ubuntu-vagrant/README.md) | | | :heavy_check_mark: Completed | Linux Ubuntu | local machine via VirtualBox | [link](/ubuntu-virtualbox/README.md) | | | :heavy_check_mark: Completed | Linux Ubuntu | remote machine at [SURF HPC Cloud] | [link](/ubuntu-surf-hpc-cloud/README.md) | [CUDA installation](/ubuntu-surf-hpc-cloud/with-cuda/README.md) | diff --git a/ubuntu-slurm/README.md b/ubuntu-singularity/README.md similarity index 100% rename from ubuntu-slurm/README.md rename to ubuntu-singularity/README.md diff --git a/ubuntu-slurm/ga-runner-singularity.def b/ubuntu-singularity/github-actions-runner-singularity.def similarity index 58% rename from ubuntu-slurm/ga-runner-singularity.def rename to ubuntu-singularity/github-actions-runner-singularity.def index eeba2e5..33365f7 100644 --- a/ubuntu-slurm/ga-runner-singularity.def +++ b/ubuntu-singularity/github-actions-runner-singularity.def @@ -11,11 +11,18 @@ Stage: build # /entrypoint.sh / %environment - export LC_ALL=C - export DEBIAN_FRONTEND=noninteractive - export RUNNER_VERSION=2.267.1 + # export LC_ALL=C + # export DEBIAN_FRONTEND=noninteractive + # export RUNNER_VERSION=2.267.1 + # echo 'export RUNNER_VERSION=2.267.1' >>$SINGULARITY_ENVIRONMENT + export AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache + export platform_version=18.04 %post + export RUNNER_VERSION=2.267.1 + # main script + chmod +x /entrypoint.sh + apt-get install -y --no-install-recommends software-properties-common add-apt-repository universe add-apt-repository multiverse @@ -25,8 +32,20 @@ Stage: build curl \ jq \ libcurl4-openssl-dev + + + echo ${RUNNER_VERSION} + mkdir /opt/actions-runner && cd /opt/actions-runner + curl -L "https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz" > actions_runner.tar.gz && \ + tar -zxf actions_runner.tar.gz && \ + rm -f actions_runner.tar.gz && \ + ./bin/installdependencies.sh + # chmod -R 755 /opt/actions-runner + NOW=`date` echo "export NOW=\"${NOW}\"" >> $SINGULARITY_ENVIRONMENT + echo "export AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache" >> $SINGULARITY_ENVIRONMENT + %runscript echo "Container was created $NOW" From 425c73e1f5ad0839eb256fe47d1a547cdff290f2 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 17:43:25 +0200 Subject: [PATCH 02/31] add intro --- ubuntu-singularity/README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ubuntu-singularity/README.md b/ubuntu-singularity/README.md index 6bdc92d..9ae86e9 100644 --- a/ubuntu-singularity/README.md +++ b/ubuntu-singularity/README.md @@ -1,16 +1,19 @@ -# Setting up a CI server for a GitHub Action runner on a HPC cluster from Linux Ubuntu +# Setting up a CI server for a GitHub Action runner Singularity from Linux Ubuntu -After following this guide, you'll have a simple GitHub action workflow on a GitHub repository of your choice. When new -commits are made to your repository, the workflow delegates work to a server which runs in a HPC cluster.The guide assumes that you have an acess to a HPC cluster which uses `slurm` as a scheduler. +After following this guide, you'll have a simple GitHub action workflow on a GitHub repository of your choice. When new commits are made to your repository, the workflow delegates work to a server which runs in a [Singlularity](https://sylabs.io/singularity/) container. You can use this Singularity container to on a HPC cluster. This guide distinguishes between the _client_ and the _server_; the client is your own machine; the server is whichever -machine will run the tests. This document describes the case where the server is a HPC cluster. +machine will run the tests. This document describes the case where the server is a Singularity container running on your own machine. For guides on how to configure other features in addition to just the runner, go [here](/README.md). ## Prerequisites -1. Install singularity +1. Install Singularity: https://sylabs.io/guides/3.5/user-guide/quick_start.html#quick-installation-steps + +2. Follow a [short tutorial](https://sylabs.io/guides/3.5/user-guide/quick_start.html#overview-of-the-singularity-interface) (Optional) + +### Testing your Singularity setup ```shell > singularity version From dc896703fb65a44647cccd19057c8890d79806ab Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 17:49:49 +0200 Subject: [PATCH 03/31] add Singularity test commands --- ubuntu-singularity/README.md | 256 ++--------------------------------- 1 file changed, 10 insertions(+), 246 deletions(-) diff --git a/ubuntu-singularity/README.md b/ubuntu-singularity/README.md index 9ae86e9..2cf7525 100644 --- a/ubuntu-singularity/README.md +++ b/ubuntu-singularity/README.md @@ -15,269 +15,33 @@ For guides on how to configure other features in addition to just the runner, go ### Testing your Singularity setup +Check Singularity version ```shell > singularity version 3.5.3 ``` -## Server side configuration - -E.g. how to configure VirtualBox, how to run docker container, how to configure HPC cloud machine - -### Install SSH Client - -e.g. - -- sudo apt install openssh-client -- install putty -- homebrew install ssh - -### Generate SSH key pair - -Generate a key pair (files ``id_rsa`` and ``id_rsa.pub``) in directory -[``something/something``](something/something) using RSA encryption: - -**Note: ``id_rsa`` is the private half of the SSH key pair; don't share it with anybody else.** - -**e.g.** +Pull an example image ```shell -cd something/something/ -ssh-keygen -t rsa -f ./id_rsa -N '' -``` -Make sure that the permissions are set correctly: - -``` -chmod 600 id_rsa -chmod 644 id_rsa.pub +singularity pull library://sylabsed/examples/lolcow ``` -Note you can use ``stat``'s ``%a`` option to see a file's permissions as an octal number, e.g. +Start a shell in the Singlarity container ```shell -stat -c "%a %n" -stat -c "%a %n" `ls -1` +singularity shell lolcow_latest.sif ``` - -### Copy the key pair to server - -Copy the public half of the key pair (i.e. ``id_rsa.pub``) to the server. - -**e.g.** +Sun some test commands ```shell -ssh-copy-id -i ./id_rsa.pub -p 2222 tester@127.0.0.1 -``` - - -### Test connection with server using ``ssh`` +Singularity> id -Test if you can SSH into the server using the other half of the key pair (i.e. ``id_rsa``) +uid=1000(fdiblen) gid=985(users) groups=985(users),98(power),108(vboxusers),972(docker),988(storage),998(wheel) -**e.g.** +Singularity> hostname -```shell -ssh -i ./id_rsa -p 2222 tester@127.0.0.1 +archlinux ``` - -If you get a ``Host key verification failed`` error, clear the existing key with - -```shell -ssh-keygen -R "[127.0.0.1]:2222" -``` - -and try again. - - -Log out of the server with - -```shell -exit -``` - -### Troubleshooting SSH - -Getting SSH connections to work can be tricky. Check out [this document](/docs/troubleshooting-ssh.md) if you're -experiencing difficulties. - -### The inventory file - -Ansible uses so-called _inventory_ files to define how to connect to remote machines. The inventory file is typically -called ``hosts``. The following inventory file is equivalent to the ``ssh`` command line we just used: - -```yaml -all: - hosts: - ci-server: - ansible_connection: ssh - ansible_host: 127.0.0.1 - ansible_port: 2222 - ansible_ssh_private_key_file: ./id_rsa - ansible_user: tester -``` - -This inventory file defines a group ``all`` with just one machine in it, which we labeled ``ci-server``. ``ci-server`` -has a bunch of variables that define how to connect to it. For more information on inventory files, read -[Ansible's documentation](https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html). - -### The Ansible configuration file - -In addition to the inventory file, it's often convenient to use a configuration file. The default filename for this file -is ``ansible.cfg``, and it can be used to specify Ansible's behavior. The configuration option documentation can be -found [here](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#the-configuration-file). - -### Test connection with server using ``ansible`` - -We're about ready to test if we can connect to the server using Ansible. For this we will use the ``ping`` module, and -we'll instruct Ansible to run the module on all hosts as defined in the inventory, as follows: - -```shell -ansible all -m ping -``` - -Which should return: - -```text -ci-server | SUCCESS => { - "changed": false, - "ping": "pong" -} -``` - -### Install the runner using the playbook - -For more complicated tasks than ``ping``, it's often inconvenient having to put everything on the command line. Instead, -a better option is to create a so-called _playbook_ containing all the steps that you want to include in your -provisioning. The playbook is a YAML file that defines a series of ``tasks``. When creating new tasks, one can start -from scratch, or make use of tasks that have been published by others (see https://galaxy.ansible.com/). - -We're almost ready to use ``ansible-playbook`` to set up a GitHub Runner on your own server, but first we need to -generate an OAuth token, as follows: - -1. Go to [https://github.com/settings/tokens](https://github.com/settings/tokens) and click the ``Generate new token`` button. -1. Provide your GitHub password when prompted -1. Fill in a description for the token, for example _GitHub runner for github.com/<your organization>/<your repository>_ -1. Enable the ``repo`` scope and all of its checkboxes, like so: - - ![Token permissions](/images/token_permissions.png) - -1. Click ``Generate`` at the bottom. Make sure to copy its value because we'll need it in the next step - -Configuring your server such that it can run continuous integration requires 4 pieces of information, for which you will be prompted: - -1. Because our playbook requires elevated permissions, the command uses the ``--ask-become-pass`` option to prompt for -the root password. Fill in the password ``password`` to become ``root`` in the server. -1. Fill in the GitHub organization (which might be simply your GitHub user name) and ... -1. ...the repository name for which you want to run workflows on a self-hosted server -1. Finally, you need to supply the Personal Access Token - -Now run this command to provision the GitHub Action runner on your server: - -```shell -ansible-playbook playbook.yml --ask-become-pass -``` - -If you now go to GitHub [https://github.com/<your organization>/<your repository>/settings/actions](https://github.com/%3Cyour%20organization%3E/%3Cyour%20repository%3E/settings/actions), -you should see a self-hosted runner with status "Idle": - -![Self hosted runner status is Idle](/images/github-self-hosted-runners-status-idle.png) - -Add the following simple workflow as ``.github/workflows/self_hosted_ci.yml`` in your repository: - -```yaml -name: Self-hosted CI example - -on: [push, pull_request] - -jobs: - test: - name: test - runs-on: self-hosted - steps: - - name: Show directory listing - shell: bash -l {0} - run: | - ls -la -``` - -Now try making a change to one of the files in your repository to see if you can trigger running the simple workflow -on your self-hosted server. If successful, the status will change to "Active" while the workflow is running. You can -get an overview of previous GitHub actions by navigating to [https://github.com/<your organization>/<your repository>/actions](https://github.com/%3Cyour%20organization%3E/%3Cyour%20repository%3E/actions). - - -### Monitoring the runner service's logs - -The log of the runner can be viewed with - -```shell -ssh -i -p @ -``` - -Then - -```shell -journalctl -u actions.runner.* -``` - -### Start the runner each time the machine boots - -```shell -ansible-playbook playbook.yml --tags enable -``` - -### Start the runner - -```shell -ansible-playbook playbook.yml --tags start -``` - -### Managing the runner service through the playbook - -```shell -ansible-playbook playbook.yml --tags start -ansible-playbook playbook.yml --tags stop -ansible-playbook playbook.yml --tags restart -ansible-playbook playbook.yml --tags status -ansible-playbook playbook.yml --tags enable -ansible-playbook playbook.yml --tags disable -``` - -Uninstalling the runner - -```shell -ansible-playbook playbook.yml --tags uninstall -``` - -### Verify that your newly configured runner is triggered - -Add the following simple workflow as ``.github/workflows/self_hosted_ci.yml`` in your repository -[https://github.com/<your organization>/<your repository>](https://github.com/%3Cyour%20organization%3E/%3Cyour%20repository%3E): - -```yaml -name: Self-hosted CI example - -on: [push, pull_request] - -jobs: - test: - name: test - runs-on: self-hosted - steps: - - name: Show directory listing - shell: bash -l {0} - run: | - ls -la -``` - -With this workflow in place, new pushes and new pull requests should trigger your self-hosted server. -Try making a change to one of the files in your repository to see if you can trigger running the simple workflow -on your self-hosted server. If successful, the status will change to "Active" while the workflow is running. -You can see a record of past and current GitHub Actions by pointing your browser to -[https://github.com/<your organization>/<your repository>/actions?query=workflow:"Self-hosted+CI+example"](https://github.com/%3Cyour%20organization%3E/%3Cyour%20repository%3E/actions?query=workflow%3A%22Self-hosted+CI+example%22). - - -### What's next - -Find instructions for provisioning additional functionality [here](../README.md). From 2f857af4bc3d703f23aeb3a75e2e21653ed4f6b8 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 18:37:21 +0200 Subject: [PATCH 04/31] add server side instructions --- ubuntu-singularity/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ubuntu-singularity/README.md b/ubuntu-singularity/README.md index 2cf7525..af3fdfe 100644 --- a/ubuntu-singularity/README.md +++ b/ubuntu-singularity/README.md @@ -45,3 +45,15 @@ Singularity> hostname archlinux ``` + +## Server side configuration + +### Build image + +Now we are ready to build our Singularity image. The following command will use [Definition file](github-actions-runner-singularity.def) to build the image. It will create a system install necessary system packages and dependencies for the runner. In order to create a Singularity image, you will need root permission (or sudo) on your system. + +```shell +sudo singularity build github-actions-runner-singularity.sif github-actions-runner-singularity.def +``` + +This command will generate ``github-actions-runner-singularity.sif`` image. From ecb7f4adfe633e6c17be332e28d3a95dab9a573a Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 19:04:25 +0200 Subject: [PATCH 05/31] add token instructions --- ubuntu-singularity/README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/ubuntu-singularity/README.md b/ubuntu-singularity/README.md index af3fdfe..f4d5665 100644 --- a/ubuntu-singularity/README.md +++ b/ubuntu-singularity/README.md @@ -56,4 +56,20 @@ Now we are ready to build our Singularity image. The following command will use sudo singularity build github-actions-runner-singularity.sif github-actions-runner-singularity.def ``` -This command will generate ``github-actions-runner-singularity.sif`` image. +This command will generate ``github-actions-runner-singularity.sif`` (SIF stands for Singularity Image Format) image which we will use to set up the runner. + +## Client side configuration + +### Generate an OAuth token + +We're almost ready to use our Docker image to set up a GitHub Runner, but first we need to +generate an OAuth token, as follows: + +1. Go to [https://github.com/settings/tokens](https://github.com/settings/tokens) and click the ``Generate new token`` button. +2. Provide your GitHub password when prompted +3. Fill in a description for the token, for example _GitHub runner for github.com/<your organization>/<your repository>_ +4. Enable the ``repo`` scope and all of its checkboxes, like so: + + ![Token permissions](/images/token_permissions.png) + +5. Click ``Generate`` at the bottom. Make sure to copy its value because we'll need it in the next step From 252c445015ad07e9f19d1cab0dca95853d2ff314 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 19:04:52 +0200 Subject: [PATCH 06/31] add required env variables --- ubuntu-singularity/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ubuntu-singularity/README.md b/ubuntu-singularity/README.md index f4d5665..20b72db 100644 --- a/ubuntu-singularity/README.md +++ b/ubuntu-singularity/README.md @@ -73,3 +73,17 @@ generate an OAuth token, as follows: ![Token permissions](/images/token_permissions.png) 5. Click ``Generate`` at the bottom. Make sure to copy its value because we'll need it in the next step + +### Run the server + +#### Preperation +Before using the Singularity image we need to set some environment variables. The Singularity container will use these environment variables to set up the runner. + +```shell +export SINGULARITYENV_PERSONAL_ACCESS_TOKEN="" +export SINGULARITYENV_RUNNER_NAME="" +export SINGULARITYENV_RUNNER_WORKDIR="/tmp/actions-runner-repo" +export SINGULARITYENV_GITHUB_ORG="" +export SINGULARITYENV_GITHUB_REPO="" +``` + From 7f9f19c916d6c7653d87c0ba10f6926be1ce9c5e Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 19:05:23 +0200 Subject: [PATCH 07/31] add instructions to start the container --- ubuntu-singularity/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ubuntu-singularity/README.md b/ubuntu-singularity/README.md index 20b72db..b5f1f0d 100644 --- a/ubuntu-singularity/README.md +++ b/ubuntu-singularity/README.md @@ -87,3 +87,17 @@ export SINGULARITYENV_GITHUB_ORG="" export SINGULARITYENV_GITHUB_REPO="" ``` +#### Temporary mode + +Now we can run Singularity container with the following command. + +```shell +singularity run \ + --writable-tmpfs \ + github-actions-runner-singularity.sif +``` + +Singularity containers by-default starts in ``read-only`` mode so you cannot make changes. While setting up the runner, some scripts needs to create a few files so we need a write access. This is achieved by adding ``--writable-tmpfs`` argument. + +If you stop the running container or interrupt it by pressing to ``CTRL+C``, the Github actions runner will stop and it will be unregistered from your Github repository. + From 40d73076cb5688880cb1b12203de7962a690a36b Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 19:05:50 +0200 Subject: [PATCH 08/31] add instructions for instance mode --- ubuntu-singularity/README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/ubuntu-singularity/README.md b/ubuntu-singularity/README.md index b5f1f0d..6b18a50 100644 --- a/ubuntu-singularity/README.md +++ b/ubuntu-singularity/README.md @@ -101,3 +101,32 @@ Singularity containers by-default starts in ``read-only`` mode so you cannot mak If you stop the running container or interrupt it by pressing to ``CTRL+C``, the Github actions runner will stop and it will be unregistered from your Github repository. +#### Instance mode + +Alternatively, you can start it as an instance (service). + +```shell +singularity instance start github-actions-runner-singularity.sif github-actions-runner --writable-tmpfs +``` + +For more information about Singularity services see [this link](https://sylabs.io/guides/3.5/user-guide/running_services.html). + + +To list the running instances: + +```shell +singularity instance list +``` + +To stop the running Singularity instance: + +```shell +singularity instance stop github-actions-runner +``` + +To start the Singularity instance again: + +```shell +singularity instance start github-actions-runner +``` + From fa335b8b63b22cbbca0265e97c629ccd742e94c1 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 19:15:21 +0200 Subject: [PATCH 09/31] add extras section --- ubuntu-singularity/README.md | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/ubuntu-singularity/README.md b/ubuntu-singularity/README.md index 6b18a50..4311533 100644 --- a/ubuntu-singularity/README.md +++ b/ubuntu-singularity/README.md @@ -1,6 +1,6 @@ # Setting up a CI server for a GitHub Action runner Singularity from Linux Ubuntu -After following this guide, you'll have a simple GitHub action workflow on a GitHub repository of your choice. When new commits are made to your repository, the workflow delegates work to a server which runs in a [Singlularity](https://sylabs.io/singularity/) container. You can use this Singularity container to on a HPC cluster. +After following this guide, you'll have a simple GitHub action workflow on a GitHub repository of your choice. When new commits are made to your repository, the workflow delegates work to a server which runs in a [Singlularity](https://sylabs.io/singularity/) container. You can use this Singularity container to on a HPC cluster as a regular user and you will not need root permissions. This guide distinguishes between the _client_ and the _server_; the client is your own machine; the server is whichever machine will run the tests. This document describes the case where the server is a Singularity container running on your own machine. @@ -130,3 +130,36 @@ To start the Singularity instance again: singularity instance start github-actions-runner ``` + +### Extras + +#### Get Singularity image details + +Use `singularity inspect` to display details of the image + +```shell +> singularity inspect github-actions-runner-singularity.sif* +WARNING: No SIF metadata partition, searching in container... +org.label-schema.build-date: Monday_6_July_2020_16:55:58_CEST +org.label-schema.schema-version: 1.0 +org.label-schema.usage.singularity.deffile.bootstrap: library +org.label-schema.usage.singularity.deffile.from: ubuntu:19.10 +org.label-schema.usage.singularity.deffile.mirrorurl: http://us.archive.ubuntu.com/ubuntu/ +org.label-schema.usage.singularity.deffile.osversion: eoan +org.label-schema.usage.singularity.deffile.stage: build +org.label-schema.usage.singularity.version: 3.5.3 +``` + +#### Accessing Singularity container + +If you need access to a shell on the running Singularity container: + +```shell +singularity shell \ + --writable-tmpfs \ + github-actions-runner-singularity.sif +``` + +### What's next + +Find instructions for provisioning additional functionality [here](../README.md). From 18f7fd025246726ac022264b225d2f8931769848 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 19:33:02 +0200 Subject: [PATCH 10/31] add HPC section --- ubuntu-singularity/README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/ubuntu-singularity/README.md b/ubuntu-singularity/README.md index 4311533..87c388e 100644 --- a/ubuntu-singularity/README.md +++ b/ubuntu-singularity/README.md @@ -130,6 +130,34 @@ To start the Singularity instance again: singularity instance start github-actions-runner ``` +## Using on a HPC Cluster + +In oder to use the Singularity image on a HPC cluster, we first need to create a jobscript. The job script will be handled by the scheduler and eventually it will set up the runner when it is executed. + +Example: +``` +#!/bin/bash +#SBATCH -t 1:00:00 +#SBATCH -n 480 + +cd $HOME/work + +export SINGULARITYENV_PERSONAL_ACCESS_TOKEN="" +export SINGULARITYENV_RUNNER_NAME="" +export SINGULARITYENV_RUNNER_WORKDIR="/tmp/actions-runner-repo" +export SINGULARITYENV_GITHUB_ORG="" +export SINGULARITYENV_GITHUB_REPO="" + +srun singularity run \ + --writable-tmpfs \ + github-actions-runner-singularity.sif +``` + +To submit the job script using ``sbatch``: + +```shell +sbatch jobscript +``` ### Extras From 01778972d8bf71fdcba70a416d856689cb65a350 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 19:33:26 +0200 Subject: [PATCH 11/31] add GPU section with a link --- ubuntu-singularity/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ubuntu-singularity/README.md b/ubuntu-singularity/README.md index 87c388e..04d9919 100644 --- a/ubuntu-singularity/README.md +++ b/ubuntu-singularity/README.md @@ -159,6 +159,11 @@ To submit the job script using ``sbatch``: sbatch jobscript ``` +## GPU support + +See [Singularity documentation](https://sylabs.io/guides/3.5/user-guide/gpu.html) + + ### Extras #### Get Singularity image details From afad61587aa981cd7474f9964cdfb7a04ebe44d2 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 19:33:49 +0200 Subject: [PATCH 12/31] add limitations --- ubuntu-singularity/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ubuntu-singularity/README.md b/ubuntu-singularity/README.md index 04d9919..892cf30 100644 --- a/ubuntu-singularity/README.md +++ b/ubuntu-singularity/README.md @@ -163,6 +163,9 @@ sbatch jobscript See [Singularity documentation](https://sylabs.io/guides/3.5/user-guide/gpu.html) +## Limitations + +Microsoft servers have some pre-installed software (see [here](https://docs.github.com/en/actions/reference/software-installed-on-github-hosted-runners)). Self hosted runners are able to download and use these software. However, this is only possible if self-hosted runner is being run on one of the supported platforms such as Ubuntu. Otherwise, users have to install the required software by themselves. ### Extras From 901c06387856fac0e0374b5149c2f03dbbd928b5 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 19:37:53 +0200 Subject: [PATCH 13/31] clean up the def file --- .../github-actions-runner-singularity.def | 32 ++----------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/ubuntu-singularity/github-actions-runner-singularity.def b/ubuntu-singularity/github-actions-runner-singularity.def index 33365f7..5424ab8 100644 --- a/ubuntu-singularity/github-actions-runner-singularity.def +++ b/ubuntu-singularity/github-actions-runner-singularity.def @@ -2,25 +2,18 @@ Bootstrap: library From: ubuntu:19.10 Stage: build -# %setup -# touch /file1 -# touch ${SINGULARITY_ROOTFS}/file2 %files ./entrypoint.sh / - # /entrypoint.sh / %environment - # export LC_ALL=C - # export DEBIAN_FRONTEND=noninteractive - # export RUNNER_VERSION=2.267.1 - # echo 'export RUNNER_VERSION=2.267.1' >>$SINGULARITY_ENVIRONMENT + export LC_ALL=C + export DEBIAN_FRONTEND=noninteractive + export RUNNER_VERSION=2.267.1 export AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache - export platform_version=18.04 %post export RUNNER_VERSION=2.267.1 - # main script chmod +x /entrypoint.sh apt-get install -y --no-install-recommends software-properties-common @@ -51,22 +44,3 @@ Stage: build echo "Container was created $NOW" echo "Arguments received: $*" exec /bin/bash /entrypoint.sh "$@" - -# %startscript -# nc -lp $LISTEN_PORT - -# %test -# grep -q NAME=\"Ubuntu\" /etc/os-release -# if [ $? -eq 0 ]; then -# echo "Container base is Ubuntu as expected." -# else -# echo "Container base is not Ubuntu." -# fi - -# %labels -# Author d@sylabs.io -# Version v0.0.1 - -# %help -# This is a demo container used to illustrate a def file that uses all -# supported sections. From 17d7a60019ff46c223b9628349df556cce722ed2 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 19:39:38 +0200 Subject: [PATCH 14/31] more clean up --- ubuntu-singularity/github-actions-runner-singularity.def | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ubuntu-singularity/github-actions-runner-singularity.def b/ubuntu-singularity/github-actions-runner-singularity.def index 5424ab8..0d9161b 100644 --- a/ubuntu-singularity/github-actions-runner-singularity.def +++ b/ubuntu-singularity/github-actions-runner-singularity.def @@ -26,19 +26,15 @@ Stage: build jq \ libcurl4-openssl-dev - echo ${RUNNER_VERSION} mkdir /opt/actions-runner && cd /opt/actions-runner curl -L "https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz" > actions_runner.tar.gz && \ tar -zxf actions_runner.tar.gz && \ rm -f actions_runner.tar.gz && \ ./bin/installdependencies.sh - # chmod -R 755 /opt/actions-runner NOW=`date` echo "export NOW=\"${NOW}\"" >> $SINGULARITY_ENVIRONMENT - echo "export AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache" >> $SINGULARITY_ENVIRONMENT - %runscript echo "Container was created $NOW" From f5ba2371b8a9860a2f8baf367c489202a1403e17 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 19:42:07 +0200 Subject: [PATCH 15/31] add anetrypoint script --- ubuntu-singularity/entrypoint.sh | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 ubuntu-singularity/entrypoint.sh diff --git a/ubuntu-singularity/entrypoint.sh b/ubuntu-singularity/entrypoint.sh new file mode 100644 index 0000000..0c180ba --- /dev/null +++ b/ubuntu-singularity/entrypoint.sh @@ -0,0 +1,34 @@ +#!/bin/bash + + +if [[ -z "${RUNNER_NAME}" ]]; then + RUNNER_NAME="singularity-$(hostname)" +fi + +ACTIONS_URL="https://api.github.com/repos/${GITHUB_ORG}/${GITHUB_REPO}/actions/runners/registration-token" +echo "Requesting registration URL at '${ACTIONS_URL}'" + +PAYLOAD=$(curl -sX POST -H "Authorization: token ${PERSONAL_ACCESS_TOKEN}" ${ACTIONS_URL}) +export RUNNER_TOKEN=$(echo $PAYLOAD | jq .token --raw-output) + +printf "\n\033[0;44m---> Configuring the runner.\033[0m\n" +./config.sh \ + --name ${RUNNER_NAME} \ + --token ${RUNNER_TOKEN} \ + --url https://github.com/${GITHUB_ORG}/${GITHUB_REPO} \ + --work ${RUNNER_WORKDIR} \ + --labels "singularity,github" \ + --unattended \ + --replace + +remove_runner() { + printf "\n\033[0;44m---> Removing the runner.\033[0m\n" + ./config.sh remove --unattended --token "${RUNNER_TOKEN}" +} + +# run remove_runner function if "./run.sh" script is interrupted +trap "remove_runner" EXIT SIGINT SIGTERM KILL + +printf "\n\033[0;44m---> Starting the runner.\033[0m\n" +./run.sh "$*" & +wait $! From c6e841f9056a07da3abde8707dc931d58eff185d Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 19:42:31 +0200 Subject: [PATCH 16/31] cd to runner folder --- ubuntu-singularity/entrypoint.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ubuntu-singularity/entrypoint.sh b/ubuntu-singularity/entrypoint.sh index 0c180ba..19a27b2 100644 --- a/ubuntu-singularity/entrypoint.sh +++ b/ubuntu-singularity/entrypoint.sh @@ -1,5 +1,8 @@ #!/bin/bash +export AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache + +cd /opt/actions-runner if [[ -z "${RUNNER_NAME}" ]]; then RUNNER_NAME="singularity-$(hostname)" From cf202e78886aa08d985c0e044d220b642cdeaef0 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 19:42:55 +0200 Subject: [PATCH 17/31] host user is the deafault user for the runner --- ubuntu-singularity/entrypoint.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ubuntu-singularity/entrypoint.sh b/ubuntu-singularity/entrypoint.sh index 19a27b2..bfd1b63 100644 --- a/ubuntu-singularity/entrypoint.sh +++ b/ubuntu-singularity/entrypoint.sh @@ -1,5 +1,8 @@ #!/bin/bash +export RUNNER_USERNAME=$(id -un) +export RUNNER_USERGROUP=$(id -un) + export AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache cd /opt/actions-runner From d0d5992ff476429bd1325642ed530b9277e97d88 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 19:50:56 +0200 Subject: [PATCH 18/31] add env.template --- ubuntu-singularity/env.template | 1 + 1 file changed, 1 insertion(+) create mode 100644 ubuntu-singularity/env.template diff --git a/ubuntu-singularity/env.template b/ubuntu-singularity/env.template new file mode 100644 index 0000000..16c0740 --- /dev/null +++ b/ubuntu-singularity/env.template @@ -0,0 +1 @@ +AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache From 0bae920775c78822e86d90891bbba89503350dc9 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 19:51:25 +0200 Subject: [PATCH 19/31] add env file to instructions --- ubuntu-singularity/README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ubuntu-singularity/README.md b/ubuntu-singularity/README.md index 892cf30..9da7e0d 100644 --- a/ubuntu-singularity/README.md +++ b/ubuntu-singularity/README.md @@ -87,6 +87,12 @@ export SINGULARITYENV_GITHUB_ORG="" export SINGULARITYENV_GITHUB_REPO="" ``` +Create an envionment file which will be user by the runner to save some variables. + +```shell +cp env.template env +``` + #### Temporary mode Now we can run Singularity container with the following command. @@ -94,6 +100,7 @@ Now we can run Singularity container with the following command. ```shell singularity run \ --writable-tmpfs \ + --bind ./env:/opt/actions-runner/.env \ github-actions-runner-singularity.sif ``` @@ -106,7 +113,7 @@ If you stop the running container or interrupt it by pressing to ``CTRL+C``, the Alternatively, you can start it as an instance (service). ```shell -singularity instance start github-actions-runner-singularity.sif github-actions-runner --writable-tmpfs +singularity instance start github-actions-runner-singularity.sif github-actions-runner --writable-tmpfs --bind ./env:/opt/actions-runner/.env ``` For more information about Singularity services see [this link](https://sylabs.io/guides/3.5/user-guide/running_services.html). From 34b53ec158ee169b330aab39ba02fedfd261a8fe Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 19:53:19 +0200 Subject: [PATCH 20/31] show instance mode first --- ubuntu-singularity/README.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/ubuntu-singularity/README.md b/ubuntu-singularity/README.md index 9da7e0d..65aec50 100644 --- a/ubuntu-singularity/README.md +++ b/ubuntu-singularity/README.md @@ -93,21 +93,6 @@ Create an envionment file which will be user by the runner to save some variable cp env.template env ``` -#### Temporary mode - -Now we can run Singularity container with the following command. - -```shell -singularity run \ - --writable-tmpfs \ - --bind ./env:/opt/actions-runner/.env \ - github-actions-runner-singularity.sif -``` - -Singularity containers by-default starts in ``read-only`` mode so you cannot make changes. While setting up the runner, some scripts needs to create a few files so we need a write access. This is achieved by adding ``--writable-tmpfs`` argument. - -If you stop the running container or interrupt it by pressing to ``CTRL+C``, the Github actions runner will stop and it will be unregistered from your Github repository. - #### Instance mode Alternatively, you can start it as an instance (service). @@ -137,6 +122,21 @@ To start the Singularity instance again: singularity instance start github-actions-runner ``` +#### Temporary mode + +Now we can run Singularity container with the following command. + +```shell +singularity run \ + --writable-tmpfs \ + --bind ./env:/opt/actions-runner/.env \ + github-actions-runner-singularity.sif +``` + +Singularity containers by-default starts in ``read-only`` mode so you cannot make changes. While setting up the runner, some scripts needs to create a few files so we need a write access. This is achieved by adding ``--writable-tmpfs`` argument. + +If you stop the running container or interrupt it by pressing to ``CTRL+C``, the Github actions runner will stop and it will be unregistered from your Github repository. + ## Using on a HPC Cluster In oder to use the Singularity image on a HPC cluster, we first need to create a jobscript. The job script will be handled by the scheduler and eventually it will set up the runner when it is executed. From bec4f13d3cf10028b2ae7404202c1d192e579ddd Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 20:13:06 +0200 Subject: [PATCH 21/31] Create .dockerfilelintrc --- .dockerfilelintrc | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .dockerfilelintrc diff --git a/.dockerfilelintrc b/.dockerfilelintrc new file mode 100644 index 0000000..782a730 --- /dev/null +++ b/.dockerfilelintrc @@ -0,0 +1,2 @@ +rules: + sudo_usage: off From c4ceb04d43dfa10d4ba0d89d4383225496c898f2 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 20:22:49 +0200 Subject: [PATCH 22/31] Update .dockerfilelintrc --- .dockerfilelintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.dockerfilelintrc b/.dockerfilelintrc index 782a730..405f441 100644 --- a/.dockerfilelintrc +++ b/.dockerfilelintrc @@ -1,2 +1,2 @@ rules: - sudo_usage: off + sudo_usage: on From 1061222c76c521e3ecfd3c796164fc9d8785f326 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 20:25:20 +0200 Subject: [PATCH 23/31] Delete .dockerfilelintrc --- .dockerfilelintrc | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 .dockerfilelintrc diff --git a/.dockerfilelintrc b/.dockerfilelintrc deleted file mode 100644 index 405f441..0000000 --- a/.dockerfilelintrc +++ /dev/null @@ -1,2 +0,0 @@ -rules: - sudo_usage: on From 14ca1cfd90650ac2b20b2b62188c3d95d0fc3553 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Tue, 7 Jul 2020 20:25:54 +0200 Subject: [PATCH 24/31] Update super-linter.yml --- .github/workflows/super-linter.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/super-linter.yml b/.github/workflows/super-linter.yml index adf9e54..81afe71 100644 --- a/.github/workflows/super-linter.yml +++ b/.github/workflows/super-linter.yml @@ -14,3 +14,4 @@ jobs: uses: docker://github/super-linter:v3 env: VALIDATE_ALL_CODEBASE: true + VALIDATE_DOCKER: false From 54e179c6f9cd7d4716f0a1b436a4fe088ac42cf4 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Wed, 8 Jul 2020 10:48:47 +0200 Subject: [PATCH 25/31] Update ubuntu-singularity/README.md Co-authored-by: Stefan Verhoeven --- ubuntu-singularity/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ubuntu-singularity/README.md b/ubuntu-singularity/README.md index 65aec50..a7d7340 100644 --- a/ubuntu-singularity/README.md +++ b/ubuntu-singularity/README.md @@ -172,7 +172,7 @@ See [Singularity documentation](https://sylabs.io/guides/3.5/user-guide/gpu.html ## Limitations -Microsoft servers have some pre-installed software (see [here](https://docs.github.com/en/actions/reference/software-installed-on-github-hosted-runners)). Self hosted runners are able to download and use these software. However, this is only possible if self-hosted runner is being run on one of the supported platforms such as Ubuntu. Otherwise, users have to install the required software by themselves. +GitHub owned servers have some pre-installed software (see [here](https://docs.github.com/en/actions/reference/software-installed-on-github-hosted-runners)). Self hosted runners are able to download and use these software. However, this is only possible if self-hosted runner is being run on one of the supported platforms such as Ubuntu. Otherwise, users have to install the required software by themselves. ### Extras From 2b0fba70eca387500b728b731857dd877188dc02 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Wed, 8 Jul 2020 10:49:15 +0200 Subject: [PATCH 26/31] Update ubuntu-singularity/README.md Co-authored-by: Stefan Verhoeven --- ubuntu-singularity/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ubuntu-singularity/README.md b/ubuntu-singularity/README.md index a7d7340..6246f1a 100644 --- a/ubuntu-singularity/README.md +++ b/ubuntu-singularity/README.md @@ -173,6 +173,7 @@ See [Singularity documentation](https://sylabs.io/guides/3.5/user-guide/gpu.html ## Limitations GitHub owned servers have some pre-installed software (see [here](https://docs.github.com/en/actions/reference/software-installed-on-github-hosted-runners)). Self hosted runners are able to download and use these software. However, this is only possible if self-hosted runner is being run on one of the supported platforms such as Ubuntu. Otherwise, users have to install the required software by themselves. +Also actions based on Docker images will not work as running Docker containers inside a Singularity container does not work. ### Extras From 8765f4a21096e78394bf81191747b86db30b466e Mon Sep 17 00:00:00 2001 From: Faruk D Date: Wed, 8 Jul 2020 10:50:33 +0200 Subject: [PATCH 27/31] Update ubuntu-singularity/README.md Co-authored-by: Stefan Verhoeven --- ubuntu-singularity/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ubuntu-singularity/README.md b/ubuntu-singularity/README.md index 6246f1a..57e7e52 100644 --- a/ubuntu-singularity/README.md +++ b/ubuntu-singularity/README.md @@ -34,7 +34,7 @@ Start a shell in the Singlarity container singularity shell lolcow_latest.sif ``` -Sun some test commands +Run some test commands ```shell Singularity> id From 13c0a011b32f4f7b70cc9e7a8f107159e04b0216 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Wed, 8 Jul 2020 10:52:48 +0200 Subject: [PATCH 28/31] original super-linter workflow --- .github/workflows/super-linter.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/super-linter.yml b/.github/workflows/super-linter.yml index 81afe71..adf9e54 100644 --- a/.github/workflows/super-linter.yml +++ b/.github/workflows/super-linter.yml @@ -14,4 +14,3 @@ jobs: uses: docker://github/super-linter:v3 env: VALIDATE_ALL_CODEBASE: true - VALIDATE_DOCKER: false From 7a85061b360a3c317cba44a080c374d03bc2d46b Mon Sep 17 00:00:00 2001 From: Faruk D Date: Wed, 8 Jul 2020 12:08:05 +0200 Subject: [PATCH 29/31] Update ubuntu-singularity/entrypoint.sh Co-authored-by: Stefan Verhoeven --- ubuntu-singularity/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ubuntu-singularity/entrypoint.sh b/ubuntu-singularity/entrypoint.sh index bfd1b63..32b1bbe 100644 --- a/ubuntu-singularity/entrypoint.sh +++ b/ubuntu-singularity/entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/bash export RUNNER_USERNAME=$(id -un) -export RUNNER_USERGROUP=$(id -un) +export RUNNER_USERGROUP=$(id -gn) export AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache From 6c7e7f93640980794288e429c1b9c1844cd861d3 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Wed, 8 Jul 2020 12:08:30 +0200 Subject: [PATCH 30/31] Update ubuntu-singularity/github-actions-runner-singularity.def Co-authored-by: Stefan Verhoeven --- ubuntu-singularity/github-actions-runner-singularity.def | 1 + 1 file changed, 1 insertion(+) diff --git a/ubuntu-singularity/github-actions-runner-singularity.def b/ubuntu-singularity/github-actions-runner-singularity.def index 0d9161b..97ea35e 100644 --- a/ubuntu-singularity/github-actions-runner-singularity.def +++ b/ubuntu-singularity/github-actions-runner-singularity.def @@ -24,6 +24,7 @@ Stage: build ca-certificates \ curl \ jq \ + git \ libcurl4-openssl-dev echo ${RUNNER_VERSION} From aa48f4c73294defb1612c95a6f0573cf6918ca98 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Fri, 2 Oct 2020 15:40:26 +0200 Subject: [PATCH 31/31] fixes about the PR comments --- ubuntu-docker/Dockerfile | 14 +++++++------- ubuntu-singularity/README.md | 19 +++++++++++++++++++ .../github-actions-runner-singularity.def | 2 +- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/ubuntu-docker/Dockerfile b/ubuntu-docker/Dockerfile index 5e17304..59af782 100644 --- a/ubuntu-docker/Dockerfile +++ b/ubuntu-docker/Dockerfile @@ -8,16 +8,16 @@ ENV RUNNER_VERSION=2.267.1 ENV AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache RUN apt-get update && \ - apt-get install -y --no-install-recommends ca-certificates \ - curl \ - jq \ - libcurl4-openssl-dev \ - sudo \ - tar && \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + jq \ + libcurl4-openssl-dev \ + tar && \ rm -rf /var/lib/apt/lists/* RUN printf "\n\033[0;44m---> Creating SSH user.\033[0m\n" -RUN useradd -rm -d /home/${DOCKER_USER} -s /bin/bash -G sudo -u 1001 ${DOCKER_USER} +RUN useradd -rm -d /home/${DOCKER_USER} -s /bin/bash -G ${DOCKER_USER} -u 1001 ${DOCKER_USER} RUN echo "${DOCKER_USER}:${DOCKER_PASS}" | chpasswd WORKDIR /home/${DOCKER_USER}/actions-runner diff --git a/ubuntu-singularity/README.md b/ubuntu-singularity/README.md index 57e7e52..fc4e479 100644 --- a/ubuntu-singularity/README.md +++ b/ubuntu-singularity/README.md @@ -137,10 +137,29 @@ Singularity containers by-default starts in ``read-only`` mode so you cannot mak If you stop the running container or interrupt it by pressing to ``CTRL+C``, the Github actions runner will stop and it will be unregistered from your Github repository. +#### Accessing the logs + +The singularity instances save the logs in +`~/.singularity/instances/logs/INSTANCE_NAME` folder. + ## Using on a HPC Cluster +In most of the cases, the HPC user does not have root persmissions s it wont be possible to build the Singularity image. The Singularity image can be built locally and copied to +the cluster. We will use `scp` command to copy the singularity image. + +```shell +scp github-actions-runner-singularity.sif USERNAME@CLUSTER_IP_ADDRESS:$REMOTE_FOLDER +``` + +The `$REMOTE_FOLDER` is typically your home folder which you can figure out using the command below. + +```shell +echo $HOME +``` + In oder to use the Singularity image on a HPC cluster, we first need to create a jobscript. The job script will be handled by the scheduler and eventually it will set up the runner when it is executed. + Example: ``` #!/bin/bash diff --git a/ubuntu-singularity/github-actions-runner-singularity.def b/ubuntu-singularity/github-actions-runner-singularity.def index 97ea35e..91a11c0 100644 --- a/ubuntu-singularity/github-actions-runner-singularity.def +++ b/ubuntu-singularity/github-actions-runner-singularity.def @@ -1,5 +1,5 @@ Bootstrap: library -From: ubuntu:19.10 +From: ubuntu:20.04 Stage: build