-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated README and default plugins * Updated nomad-oasis.zip * Update cron schedule for Docker workflow * Add manual workflow dispatch option * Add repository initialization workflow and build workflow
- Loading branch information
1 parent
43bab0c
commit 4023151
Showing
10 changed files
with
239 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
|
||
name: Template Repository Initialization | ||
|
||
on: | ||
# Triggers the workflow on creation of repository | ||
create: | ||
|
||
env: | ||
# Use docker.io for Docker Hub if empty | ||
REGISTRY: ghcr.io | ||
# github.repository as <account>/<repo> | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
initialize_repository: | ||
if: github.repository != 'FAIRmat-NFDI/nomad-distribution-template' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
# Replaces the template repository name in the README with the new one | ||
- name: Update README | ||
run: | | ||
sed -i "s|GITHUB_REPOSITORY_OWNER|${{ github.repository_owner }}|g" template_README.md | ||
sed -i "s|GITHUB_REPOSITORY|${{ github.repository }}|g" template_README.md | ||
mv template_README.md README.md | ||
# Replaces the template repository name in the docker config file with the new one | ||
- name: Update docker-compose.yml | ||
run: | | ||
cd nomad-oasis_files | ||
sed -i "s|FAIRMAT_NFDI/nomad-distribution-template|${{ github.repository }}|g" docker-compose.yml | ||
zip -r nomad-oasis.zip nomad-oasis | ||
cd .. | ||
# Deletes this workflow file to prevent it from running on branch creation | ||
- name: Delete initialization workflow | ||
run: rm .github/workflows/initialize.yml | ||
|
||
# Commits all changes | ||
- name: Commit repository initialization | ||
run: | | ||
git config --global user.name github-actions | ||
git config --global user.email [email protected] | ||
git commit -am "Repository initialization" | ||
git push | ||
build: | ||
if: github.repository != 'FAIRmat-NFDI/nomad-distribution-template' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
# This is used to complete the identity challenge | ||
# with sigstore/fulcio when running outside of PRs. | ||
id-token: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
# Install the cosign tool except on PR | ||
# https://github.com/sigstore/cosign-installer | ||
- name: Install cosign | ||
if: github.event_name != 'pull_request' | ||
uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1 | ||
with: | ||
cosign-release: 'v2.1.1' | ||
|
||
# Set up BuildKit Docker container builder to be able to build | ||
# multi-platform images and export cache | ||
# https://github.com/docker/setup-buildx-action | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | ||
|
||
# Login against a Docker registry except on PR | ||
# https://github.com/docker/login-action | ||
- name: Log into registry ${{ env.REGISTRY }} | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Extract metadata (tags, labels) for Docker | ||
# https://github.com/docker/metadata-action | ||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
# Build and push Docker image with Buildx (don't push on PR) | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push Docker image | ||
id: build-and-push | ||
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 | ||
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
# Sign the resulting Docker image digest except on PRs. | ||
# This will only write to the public Rekor transparency log when the Docker | ||
# repository is public to avoid leaking data. If you would like to publish | ||
# transparency data even for private images, pass --force to cosign below. | ||
# https://github.com/sigstore/cosign | ||
- name: Sign the published Docker image | ||
if: ${{ github.event_name != 'pull_request' }} | ||
env: | ||
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable | ||
TAGS: ${{ steps.meta.outputs.tags }} | ||
DIGEST: ${{ steps.build-and-push.outputs.digest }} | ||
# This step uses the identity token to provision an ephemeral certificate | ||
# against the sigstore community Fulcio instance. | ||
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
![docker image](https://github.com/hampusnasstrom/nomad-example-image/actions/workflows/docker-publish.yml/badge.svg) | ||
# nomad-example-image | ||
An example repository for creating a nomad image with custom plugins. | ||
![docker image](https://github.com/FAIRmat-NFDI/nomad-distribution-template/actions/workflows/docker-publish.yml/badge.svg) | ||
|
||
> [!IMPORTANT] | ||
> The templated repository will run a GitHub action on creation which might take a few momements. | ||
> After the workflow finishes you should refresh the page and this message should disappear. | ||
# NOMAD Oasis Distribution *Template* | ||
This repository is a template for creating your own custom NOMAD Oasis distribution image. | ||
Click [here](https://github.com/new?template_name=nomad-distribution-template&template_owner=FAIRmat-NFDI) | ||
to use this template, or click the `Use this template` button in the upper right corner of | ||
the main GitHub page for this template. | ||
|
||
## Deploying the image | ||
|
||
To deploy this NOMAD Oasis image you should follow the instructions on [nomad-lab.eu/prod/v1/docs/oasis/install.html](https://nomad-lab.eu/prod/v1/docs/oasis/install.html) but replace the Docker image in `docker-compose.yaml` with `ghcr.io/hampusnasstrom/nomad-example-image:main` for the services `worker`, `app`, `north`, and `logtransfer`. | ||
To deploy this NOMAD Oasis image you should follow the instructions on [nomad-lab.eu/prod/v1/docs/oasis/install.html](https://nomad-lab.eu/prod/v1/docs/oasis/install.html) but replace the Docker image in `docker-compose.yaml` with `ghcr.io/FAIRmat-NFDI/nomad-distribution-template:main` for the services `worker`, `app`, `north`, and `logtransfer`. | ||
|
||
Remember to also update the `nomad.yaml` config file to include the new plugins. | ||
|
||
|
@@ -34,32 +42,3 @@ the container has to be run under the docker group. You need to replace the defa | |
id `991` in the `docker-compose.yaml`'s `hub` section with your systems docker group id. | ||
Run `id` if you are a docker user, or `getent group | grep docker` to find our your | ||
systems docker gid. The user id 1000 is used as the nomad user inside all containers. | ||
|
||
## Adding a plugin | ||
|
||
To add a new plugin to the docker image you should add it to the [plugins.txt](plugins.txt) file. | ||
|
||
Here you can put either plugins distributed to PyPI, e.g. | ||
``` | ||
nomad-material-processing | ||
``` | ||
or plugins in a git repository with either the commit hash | ||
``` | ||
git+https://github.com/FAIRmat-NFDI/nomad-measurements.git@71b7e8c9bb376ce9e8610aba9a20be0b5bce6775 | ||
``` | ||
or with a tag | ||
``` | ||
git+https://github.com/FAIRmat-NFDI/[email protected] | ||
``` | ||
To add a plugin in a subdirectory of a git repository you can use the `subdirectory` option, e.g. | ||
``` | ||
git+https://github.com/FAIRmat-NFDI/AreaA-data_modeling_and_schemas.git@30fc90843428d1b36a1d222874803abae8b1cb42#subdirectory=PVD/PLD/jeremy_ikz/ikz_pld_plugin | ||
``` | ||
|
||
Once the changes have been committed to the main branch, the new image will automatically be generated. | ||
|
||
## Create your own image | ||
|
||
To create your own custom NOMAD Oasis image you can fork this repository and publish your own docker image. | ||
1. Fork repository | ||
2. Enable the GitHub workflow action |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
git+https://github.com/FAIRmat-NFDI/nomad-material-processing.git@55918771f1191ac31ae5e0d06a579b513886f3b2 | ||
git+https://github.com/FAIRmat-NFDI/AreaA-data_modeling_and_schemas.git@bb8422d5aefe114ae7e4e677262e99fecf26dcaf#subdirectory=PVD/PLD/jeremy_ikz/ikz_pld_plugin | ||
git+https://github.com/FAIRmat-NFDI/nomad-measurements.git@50f199830517ae9753c5fccea1efe2983ed7781f | ||
nomad-measurements | ||
nomad-material-processing |
Oops, something went wrong.