From 66a012f6df149d1e8a1cdcd48ced8040d653f0dc Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 24 Aug 2025 11:58:30 -0500 Subject: [PATCH 01/21] Add GitHub Actions workflow for publishing feature --- .github/workflows/publish-feature.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/publish-feature.yml diff --git a/.github/workflows/publish-feature.yml b/.github/workflows/publish-feature.yml new file mode 100644 index 0000000..deea1b3 --- /dev/null +++ b/.github/workflows/publish-feature.yml @@ -0,0 +1,21 @@ +name: Publish Devcontainer Feature + +on: + release: + types: [created] + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Devcontainer CLI + run: npm install -g @devcontainers/cli + + - name: Login to GitHub Container Registry + run: echo "${{ secrets.WRITE_PACKAGES_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Publish Devcontainer Feature + run: devcontainer features publish src/cvmfs --namespace cvmfs-contrib From 51fda3e44d2fab90687d5b6d90b4c6026dff438e Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 24 Aug 2025 16:40:38 +0000 Subject: [PATCH 02/21] feat: Add devcontainer feature and refactor for modularity --- README.md | 25 +++++++-- action.yml | 9 +++- cvmfs-install-core.sh | 29 +++++++++++ setup-cvmfs-linux.sh | 22 ++++++++ setup-cvmfs-macos.sh | 23 +++++++++ setup-cvmfs.sh | 79 ----------------------------- src/cvmfs/README.md | 39 ++++++++++++++ src/cvmfs/devcontainer-feature.json | 19 +++++++ src/cvmfs/install.sh | 6 +++ 9 files changed, 167 insertions(+), 84 deletions(-) create mode 100644 cvmfs-install-core.sh create mode 100644 setup-cvmfs-linux.sh create mode 100644 setup-cvmfs-macos.sh create mode 100644 src/cvmfs/README.md create mode 100644 src/cvmfs/devcontainer-feature.json create mode 100644 src/cvmfs/install.sh diff --git a/README.md b/README.md index c2c5fad..a1369d6 100644 --- a/README.md +++ b/README.md @@ -133,12 +133,29 @@ jobs: This GitHub Action installs the [CernVM-FS package](https://cernvm.cern.ch/fs/#download), and configures it with the `CVMFS_CLIENT_PROFILE='single'` and `CVMFS_USE_CDN='yes'` to avoid any overhead on the CernVM-FS stratum 1 servers that you are accessing, this GitHub Action uses the [OpenHTC](https://openhtc.io) caching edge servers. +## Devcontainer Usage + +This repository includes a pre-configured devcontainer for a consistent development environment. It uses the CVMFS devcontainer feature located in the `src/cvmfs` directory. + +To use it, open this repository in a devcontainer-compatible editor like VS Code with the Dev Containers extension. + +You can add other functionalities to your devcontainer by including more features. A comprehensive list of contributed features can be found in the [devcontainer feature index](https://github.com/devcontainers/devcontainers.github.io/blob/gh-pages/_data/collection-index.yml). + +For example, you can add the following to your `devcontainer.json` to use this feature: +```json +{ + "name": "CVMFS Action Dev", + "image": "mcr.microsoft.com/devcontainers/base:ubuntu", + "features": { + "ghcr.io/cvmfs-contrib/features/cvmfs:1": { + "CVMFS_REPOSITORIES": "alice.cern.ch,atlas.cern.ch" + } + } +} +``` + ## Limitations This GitHub Action is only expected to work in workflows that [run on](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on) ubuntu. There is experimental support for `macOS` (11+). `windows` targets are not supported. - -## Use With Docker - -In case your workflow uses docker containers, the cvmfs directory can be mounted inside the container by using the flag `-v /cvmfs:/cvmfs:shared`. diff --git a/action.yml b/action.yml index 1e3e99f..d944c11 100644 --- a/action.yml +++ b/action.yml @@ -357,7 +357,14 @@ runs: path: | ${{ inputs.apt_cache }} - run: | - ${{ github.action_path }}/setup-cvmfs.sh + if [ "$RUNNER_OS" == "Linux" ]; then + ${{ github.action_path }}/setup-cvmfs-linux.sh + elif [ "$RUNNER_OS" == "macOS" ]; then + ${{ github.action_path }}/setup-cvmfs-macos.sh + else + echo "Unsupported platform: $RUNNER_OS" + exit 1 + fi shell: bash env: ACTION_PATH: ${{ github.action_path }} diff --git a/cvmfs-install-core.sh b/cvmfs-install-core.sh new file mode 100644 index 0000000..e15b876 --- /dev/null +++ b/cvmfs-install-core.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# Shared CVMFS install and config logic for Linux +set -e + +# Install CVMFS release package +CVMFS_UBUNTU_DEB_LOCATION=${CVMFS_UBUNTU_DEB_LOCATION:-https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest_all.deb} +APT_ARCHIVES=/var/cache/apt/archives/ +mkdir -p ${APT_ARCHIVES} +if [ ! -f ${APT_ARCHIVES}/cvmfs-release-latest_all.deb ] ; then + curl -L -o ${APT_ARCHIVES}/cvmfs-release-latest_all.deb ${CVMFS_UBUNTU_DEB_LOCATION} +fi +dpkg -i ${APT_ARCHIVES}/cvmfs-release-latest_all.deb + +# Install CVMFS and config package +apt-get -q update +apt-get -q -y install cvmfs ${CVMFS_CONFIG_PACKAGE:-cvmfs-config-default} + +# Write config from environment variables +mkdir -p /etc/cvmfs + +echo "# cvmfs default.local file installed by cvmfs-install-core.sh" > /etc/cvmfs/default.local +for var_name in $(compgen -A variable | grep ^CVMFS_) +do + if [ -n "$(eval echo \$$var_name)" ]; then + echo "$var_name='$(eval echo \$$var_name)'" >> /etc/cvmfs/default.local + fi +done + +cvmfs_config setup diff --git a/setup-cvmfs-linux.sh b/setup-cvmfs-linux.sh new file mode 100644 index 0000000..dac4307 --- /dev/null +++ b/setup-cvmfs-linux.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# Linux-specific wrapper for CI/CD or local install +set -e + +# Optional: handle APT cache for CI/CD +if [ -n "${APT_CACHE}" ]; then + echo "Using cache from ${APT_CACHE}" + mkdir -p ${APT_CACHE}/archives/ ${APT_CACHE}/lists/ + sudo cp -r ${APT_CACHE}/archives /var/cache/apt + sudo cp -r ${APT_CACHE}/lists /var/lib/apt +fi + +# Call shared install logic +sudo bash /workspaces/github-action-cvmfs/cvmfs-install-core.sh + +# Optional: update cache after install +if [ -n "${APT_CACHE}" ]; then + echo "Updating cache to ${APT_CACHE}" + mkdir -p ${APT_CACHE}/archives/ ${APT_CACHE}/lists/ + cp /var/cache/apt/archives/*.deb ${APT_CACHE}/archives/ + cp /var/lib/apt/lists/*_dists_* ${APT_CACHE}/lists/ +fi diff --git a/setup-cvmfs-macos.sh b/setup-cvmfs-macos.sh new file mode 100644 index 0000000..fad3d3e --- /dev/null +++ b/setup-cvmfs-macos.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# macOS-specific CVMFS install logic +set -e + +echo "warning: MacOS support is experimental." + +brew tap macos-fuse-t/cask +brew tap cvmfs/homebrew-cvmfs +brew install cvmfs + +# Create /cvmfs mountpoint using synthetic firmlink +sudo zsh -c 'echo -e "cvmfs\tUsers/Shared/cvmfs\n#comment\n" > /etc/synthetic.conf' +sudo chown root:wheel /etc/synthetic.conf +sudo chmod a+r /etc/synthetic.conf +sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t || true + +# Mount repositories +for repo in $(echo ${CVMFS_REPOSITORIES} | sed "s/,/ /g") +do + mkdir -p /Users/Shared/cvmfs/${repo} + sudo mount -t cvmfs ${repo} /Users/Shared/cvmfs/${repo} +done +sleep 3 diff --git a/setup-cvmfs.sh b/setup-cvmfs.sh index 8389158..8af1997 100755 --- a/setup-cvmfs.sh +++ b/setup-cvmfs.sh @@ -1,71 +1,3 @@ -#!/usr/bin/env bash - -# Platform specific install -if [ "$(uname)" == "Linux" ]; then - # download from cache - if [ -n "${APT_CACHE}" ]; then - echo "::group::Using cache" - echo "Copying cache from ${APT_CACHE} to system locations..." - mkdir -p ${APT_CACHE}/archives/ ${APT_CACHE}/lists/ - sudo cp -r ${APT_CACHE}/archives /var/cache/apt - sudo cp -r ${APT_CACHE}/lists /var/lib/apt - echo "::endgroup::" - fi - # install cvmfs release package - echo "::group::Installing cvmfs-release" - APT_ARCHIVES=/var/cache/apt/archives/ - if [ ! -f ${APT_ARCHIVES}/cvmfs-release-latest_all.deb ] ; then - sudo curl -L -o ${APT_ARCHIVES}/cvmfs-release-latest_all.deb ${CVMFS_UBUNTU_DEB_LOCATION} - fi - sudo dpkg -i ${APT_ARCHIVES}/cvmfs-release-latest_all.deb - echo "::endgroup::" - # install cvmfs package - echo "::group::Installing cvmfs" - sudo rm -f /var/lib/man-db/auto-update - sudo apt-get -q update - sudo apt-get -q -y install cvmfs - # install cvmfs config package - if [ "${CVMFS_CONFIG_PACKAGE}" == "cvmfs-config-default" ]; then - sudo apt-get -q -y install cvmfs-config-default - else - sudo curl -L -o ${APT_ARCHIVES}/cvmfs-config.deb ${CVMFS_CONFIG_PACKAGE} - sudo dpkg -i ${APT_ARCHIVES}/cvmfs-config.deb - fi - sudo touch /var/lib/man-db/auto-update - echo "::endgroup::" - # update cache (avoid restricted partial directories) - if [ -n "${APT_CACHE}" ]; then - echo "::group::Updating cache" - echo "Copying cache from system locations to ${APT_CACHE}..." - mkdir -p ${APT_CACHE}/archives/ ${APT_CACHE}/lists/ - cp /var/cache/apt/archives/*.deb ${APT_CACHE}/archives/ - cp /var/lib/apt/lists/*_dists_* ${APT_CACHE}/lists/ - echo "::endgroup::" - fi -elif [ "$(uname)" == "Darwin" ]; then - # Warn about the phasing out of MacOS support for this action - echo "warning The CernVM-FS GitHub Action's support for MacOS \ - is still experimental." - - brew tap macos-fuse-t/cask - brew tap cvmfs/homebrew-cvmfs - brew install cvmfs - - - # / is readonly on macos 11+ - do 'synthetic firmlink' to create /cvmfs - sudo zsh -c 'echo -e "cvmfs\tUsers/Shared/cvmfs\n#comment\n" > /etc/synthetic.conf' - sudo chown root:wheel /etc/synthetic.conf - sudo chmod a+r /etc/synthetic.conf - # apfs.util seems to return non-zero error codes also on success - sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t || true - -else - echo "Unsupported platform" - exit 1 -fi - -${ACTION_PATH}/createConfig.sh - echo "::group::Running cvmfs_config setup" sudo cvmfs_config setup retCongif=$? @@ -75,14 +7,3 @@ if [ $retCongif -ne 0 ]; then exit $retCongif fi echo "::endgroup::" - - -if [ "$(uname)" == "Darwin" ]; then - for repo in $(echo ${CVMFS_REPOSITORIES} | sed "s/,/ /g") - do - mkdir -p /Users/Shared/cvmfs/${repo} - sudo mount -t cvmfs ${repo} /Users/Shared/cvmfs/${repo} - done - # Fuse-t can have a brief lag after mounting before the mountpoint responds - sleep 3 -fi diff --git a/src/cvmfs/README.md b/src/cvmfs/README.md new file mode 100644 index 0000000..a71bb70 --- /dev/null +++ b/src/cvmfs/README.md @@ -0,0 +1,39 @@ +# CVMFS Devcontainer Feature + +This directory contains a devcontainer feature for installing and configuring the CVMFS client. + +## Publishing to GHCR + +This feature is intended to be published to the GitHub Container Registry (GHCR) to be easily reusable by other projects. + +### Manual Publishing + +1. **Install the Devcontainer CLI:** + ```bash + npm install -g @devcontainers/cli + ``` + +2. **Create a Personal Access Token (PAT):** + * Go to GitHub **Settings** > **Developer settings** > **Personal access tokens** > **Tokens (classic)**. + * Generate a new token with the `write:packages` scope. + * Export the token as an environment variable: + ```bash + export WRITE_PACKAGES_TOKEN=your-personal-access-token + ``` + +3. **Log in to GHCR:** + ```bash + echo $WRITE_PACKAGES_TOKEN | docker login ghcr.io -u your-github-username --password-stdin + ``` + +4. **Publish the Feature:** + Run the following command from the root of this repository. The namespace should match the GitHub organization (`cvmfs-contrib`). + ```bash + devcontainer features publish src/cvmfs --namespace cvmfs-contrib/ + ``` + +### Automated Publishing + +This repository is configured with a GitHub Actions workflow to automate this process. When a new release is published on GitHub, the workflow will automatically build and publish the feature to GHCR. + +For this to work, the `WRITE_PACKAGES_TOKEN` secret (a Personal Access Token with `write:packages` scope) must be configured in the repository's **Settings > Secrets and variables > Actions**. diff --git a/src/cvmfs/devcontainer-feature.json b/src/cvmfs/devcontainer-feature.json new file mode 100644 index 0000000..64fb234 --- /dev/null +++ b/src/cvmfs/devcontainer-feature.json @@ -0,0 +1,19 @@ +{ + "name": "CVMFS", + "id": "cvmfs", + "version": "1.0.0", + "description": "Installs CVMFS client", + "options": { + "CVMFS_REPOSITORIES": { + "type": "string", + "default": "alice.cern.ch,atlas.cern.ch,cms.cern.ch,lhcb.cern.ch", + "description": "CVMFS repositories to enable" + }, + "CVMFS_CONFIG_REPO": { + "type": "string", + "default": "", + "description": "URL of a repository with CVMFS config files" + } + }, + "entrypoint": "install.sh" +} diff --git a/src/cvmfs/install.sh b/src/cvmfs/install.sh new file mode 100644 index 0000000..da060cd --- /dev/null +++ b/src/cvmfs/install.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -e + +# Use the shared core installer for Linux (relative path for feature packaging) +bash "$(dirname "$0")/../../cvmfs-install-core.sh" \ No newline at end of file From bdbd47bf39045be88ea958623428c5ee95d4ff25 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 24 Aug 2025 12:11:50 -0500 Subject: [PATCH 03/21] Re-add Docker usage instructions to README Added instructions for using the GitHub Action with Docker. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index a1369d6..3bb2e20 100644 --- a/README.md +++ b/README.md @@ -159,3 +159,7 @@ For example, you can add the following to your `devcontainer.json` to use this f This GitHub Action is only expected to work in workflows that [run on](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on) ubuntu. There is experimental support for `macOS` (11+). `windows` targets are not supported. + +## Use With Docker + +In case your workflow uses docker containers, the cvmfs directory can be mounted inside the container by using the flag `-v /cvmfs:/cvmfs:shared`. From 51241d3958f9c333ee02af37fc36a8e46205c004 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 24 Aug 2025 17:25:23 +0000 Subject: [PATCH 04/21] Bring back some filename consistency and configuration --- createConfig.sh => create-config.sh | 0 cvmfs-install-core.sh => install-cvmfs-linux.sh | 4 +++- setup-cvmfs-config.sh | 13 +++++++++++++ setup-cvmfs-linux.sh | 2 +- setup-cvmfs-macos.sh | 4 ++++ setup-cvmfs.sh | 9 --------- src/cvmfs/install.sh | 2 +- 7 files changed, 22 insertions(+), 12 deletions(-) rename createConfig.sh => create-config.sh (100%) rename cvmfs-install-core.sh => install-cvmfs-linux.sh (93%) create mode 100755 setup-cvmfs-config.sh delete mode 100755 setup-cvmfs.sh diff --git a/createConfig.sh b/create-config.sh similarity index 100% rename from createConfig.sh rename to create-config.sh diff --git a/cvmfs-install-core.sh b/install-cvmfs-linux.sh similarity index 93% rename from cvmfs-install-core.sh rename to install-cvmfs-linux.sh index e15b876..72d1fef 100644 --- a/cvmfs-install-core.sh +++ b/install-cvmfs-linux.sh @@ -26,4 +26,6 @@ do fi done -cvmfs_config setup +# Configure CVMFS +bash create-config.sh +bash setup-cvmfs-config.sh \ No newline at end of file diff --git a/setup-cvmfs-config.sh b/setup-cvmfs-config.sh new file mode 100755 index 0000000..33adae7 --- /dev/null +++ b/setup-cvmfs-config.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# CVMFS configuration logic +set -e + +echo "::group::Running cvmfs_config setup" +sudo cvmfs_config setup +retConfig=$? +if [ $retConfig -ne 0 ]; then + echo "!!! github-action-cvmfs FAILED !!!" + echo "cvmfs_config setup exited with ${retConfig}" + exit $retConfig +fi +echo "::endgroup::" diff --git a/setup-cvmfs-linux.sh b/setup-cvmfs-linux.sh index dac4307..36cc39e 100644 --- a/setup-cvmfs-linux.sh +++ b/setup-cvmfs-linux.sh @@ -11,7 +11,7 @@ if [ -n "${APT_CACHE}" ]; then fi # Call shared install logic -sudo bash /workspaces/github-action-cvmfs/cvmfs-install-core.sh +sudo bash "$(dirname "$0")/install-cvmfs-linux.sh # Optional: update cache after install if [ -n "${APT_CACHE}" ]; then diff --git a/setup-cvmfs-macos.sh b/setup-cvmfs-macos.sh index fad3d3e..cb931f9 100644 --- a/setup-cvmfs-macos.sh +++ b/setup-cvmfs-macos.sh @@ -21,3 +21,7 @@ do sudo mount -t cvmfs ${repo} /Users/Shared/cvmfs/${repo} done sleep 3 + +# Configure CVMFS +bash create-config.sh +bash setup-cvmfs-config.sh \ No newline at end of file diff --git a/setup-cvmfs.sh b/setup-cvmfs.sh deleted file mode 100755 index 8af1997..0000000 --- a/setup-cvmfs.sh +++ /dev/null @@ -1,9 +0,0 @@ -echo "::group::Running cvmfs_config setup" -sudo cvmfs_config setup -retCongif=$? -if [ $retCongif -ne 0 ]; then - echo "!!! github-action-cvmfs FAILED !!!" - echo "cvmfs_config setup exited with ${retCongif}" - exit $retCongif -fi -echo "::endgroup::" diff --git a/src/cvmfs/install.sh b/src/cvmfs/install.sh index da060cd..45d9e07 100644 --- a/src/cvmfs/install.sh +++ b/src/cvmfs/install.sh @@ -3,4 +3,4 @@ set -e # Use the shared core installer for Linux (relative path for feature packaging) -bash "$(dirname "$0")/../../cvmfs-install-core.sh" \ No newline at end of file +bash "$(dirname "$0")/../../install-cvmfs-linux.sh" \ No newline at end of file From 34c19b0031c58925a1a9afdbbab57c02ac024f86 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 24 Aug 2025 12:26:39 -0500 Subject: [PATCH 05/21] Fix link to devcontainer features --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3bb2e20..9befb03 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ This repository includes a pre-configured devcontainer for a consistent developm To use it, open this repository in a devcontainer-compatible editor like VS Code with the Dev Containers extension. -You can add other functionalities to your devcontainer by including more features. A comprehensive list of contributed features can be found in the [devcontainer feature index](https://github.com/devcontainers/devcontainers.github.io/blob/gh-pages/_data/collection-index.yml). +You can add other functionalities to your devcontainer by including more features. A comprehensive list of contributed features can be found in the [devcontainer feature index](https://containers.dev/features). For example, you can add the following to your `devcontainer.json` to use this feature: ```json From 473d9ac2e0f35b1b6f9de0cbd3d28548f8043439 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 24 Aug 2025 17:28:25 +0000 Subject: [PATCH 06/21] Ensure setup scripts run in bash --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index d944c11..7587b01 100644 --- a/action.yml +++ b/action.yml @@ -358,9 +358,9 @@ runs: ${{ inputs.apt_cache }} - run: | if [ "$RUNNER_OS" == "Linux" ]; then - ${{ github.action_path }}/setup-cvmfs-linux.sh + bash ${{ github.action_path }}/setup-cvmfs-linux.sh elif [ "$RUNNER_OS" == "macOS" ]; then - ${{ github.action_path }}/setup-cvmfs-macos.sh + bash ${{ github.action_path }}/setup-cvmfs-macos.sh else echo "Unsupported platform: $RUNNER_OS" exit 1 From 30800312f92a639a285d68af276a06b04c9746f0 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 24 Aug 2025 17:31:15 +0000 Subject: [PATCH 07/21] Fix typo --- setup-cvmfs-linux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-cvmfs-linux.sh b/setup-cvmfs-linux.sh index 36cc39e..9d2ca54 100644 --- a/setup-cvmfs-linux.sh +++ b/setup-cvmfs-linux.sh @@ -11,7 +11,7 @@ if [ -n "${APT_CACHE}" ]; then fi # Call shared install logic -sudo bash "$(dirname "$0")/install-cvmfs-linux.sh +sudo bash "$(dirname "$0")/install-cvmfs-linux.sh" # Optional: update cache after install if [ -n "${APT_CACHE}" ]; then From 788f05f900d8d9968d1be6308131c88a43902a34 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 24 Aug 2025 17:43:19 +0000 Subject: [PATCH 08/21] Add feature package test workflow --- .github/workflows/package-feature.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/package-feature.yml diff --git a/.github/workflows/package-feature.yml b/.github/workflows/package-feature.yml new file mode 100644 index 0000000..fd261fe --- /dev/null +++ b/.github/workflows/package-feature.yml @@ -0,0 +1,14 @@ +name: with cvmfs_http_proxy +on: [push, pull_request] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + - name: Install Devcontainer CLI + run: npm install -g @devcontainers/cli + - name: Package CVMFS Feature + run: devcontainer features package src/cvmfs/ + - name: Generate CVMFS Feature Docs + run: devcontainer features generate-docs -p . -n cvmfs-contrib/cvmfs \ No newline at end of file From 93cff7d7f6c7ae23c5ef51ec8cd25bf84c31f2d0 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 24 Aug 2025 18:56:14 +0000 Subject: [PATCH 09/21] Use sudo -E to preserve environment (configuration) --- setup-cvmfs-linux.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup-cvmfs-linux.sh b/setup-cvmfs-linux.sh index 9d2ca54..29e8b93 100644 --- a/setup-cvmfs-linux.sh +++ b/setup-cvmfs-linux.sh @@ -10,8 +10,8 @@ if [ -n "${APT_CACHE}" ]; then sudo cp -r ${APT_CACHE}/lists /var/lib/apt fi -# Call shared install logic -sudo bash "$(dirname "$0")/install-cvmfs-linux.sh" +# Call shared install logic (preserve environment with configuration) +sudo -E bash "$(dirname "$0")/install-cvmfs-linux.sh" # Optional: update cache after install if [ -n "${APT_CACHE}" ]; then From 86135f410ea2271d6630780ed29801f8dc07965c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 24 Aug 2025 18:58:29 +0000 Subject: [PATCH 10/21] Rename workflow to Package Devcontainer Feature --- .github/workflows/package-feature.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/package-feature.yml b/.github/workflows/package-feature.yml index fd261fe..2fec4b7 100644 --- a/.github/workflows/package-feature.yml +++ b/.github/workflows/package-feature.yml @@ -1,4 +1,4 @@ -name: with cvmfs_http_proxy +name: Package Devcontainer Feature on: [push, pull_request] jobs: build: From 5de76b7be0893c2e8d2948df019ea1827ee57a06 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 24 Aug 2025 19:01:26 +0000 Subject: [PATCH 11/21] Configure CVMFS before mounting on macOS --- setup-cvmfs-macos.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/setup-cvmfs-macos.sh b/setup-cvmfs-macos.sh index cb931f9..fb01f79 100644 --- a/setup-cvmfs-macos.sh +++ b/setup-cvmfs-macos.sh @@ -14,14 +14,14 @@ sudo chown root:wheel /etc/synthetic.conf sudo chmod a+r /etc/synthetic.conf sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t || true +# Configure CVMFS +bash create-config.sh +bash setup-cvmfs-config.sh + # Mount repositories for repo in $(echo ${CVMFS_REPOSITORIES} | sed "s/,/ /g") do mkdir -p /Users/Shared/cvmfs/${repo} sudo mount -t cvmfs ${repo} /Users/Shared/cvmfs/${repo} done -sleep 3 - -# Configure CVMFS -bash create-config.sh -bash setup-cvmfs-config.sh \ No newline at end of file +sleep 3 \ No newline at end of file From df83e80b6c43bb9c71b74e8d2a3b3e09fad9474c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 24 Aug 2025 19:02:20 +0000 Subject: [PATCH 12/21] Re-add on need for sleep on macOS --- setup-cvmfs-macos.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup-cvmfs-macos.sh b/setup-cvmfs-macos.sh index fb01f79..23b5e10 100644 --- a/setup-cvmfs-macos.sh +++ b/setup-cvmfs-macos.sh @@ -24,4 +24,6 @@ do mkdir -p /Users/Shared/cvmfs/${repo} sudo mount -t cvmfs ${repo} /Users/Shared/cvmfs/${repo} done + +# Fuse-t can have a brief lag after mounting before the mountpoint responds sleep 3 \ No newline at end of file From 195f0bb303f5bc38c59ac80b105e3f2ead51a371 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 24 Aug 2025 20:03:06 +0000 Subject: [PATCH 13/21] Use correct src/ directory in devcontainer features generate-docs --- .github/workflows/package-feature.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/package-feature.yml b/.github/workflows/package-feature.yml index 2fec4b7..921891e 100644 --- a/.github/workflows/package-feature.yml +++ b/.github/workflows/package-feature.yml @@ -11,4 +11,4 @@ jobs: - name: Package CVMFS Feature run: devcontainer features package src/cvmfs/ - name: Generate CVMFS Feature Docs - run: devcontainer features generate-docs -p . -n cvmfs-contrib/cvmfs \ No newline at end of file + run: devcontainer features generate-docs -p src/ -n cvmfs-contrib/cvmfs \ No newline at end of file From ca26869844fe32ff752a0bc704f80ccc7cdcf9bb Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 25 Aug 2025 14:44:50 +0000 Subject: [PATCH 14/21] Re-add CVMFS config package logic --- install-cvmfs-linux.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/install-cvmfs-linux.sh b/install-cvmfs-linux.sh index 72d1fef..ee78bff 100644 --- a/install-cvmfs-linux.sh +++ b/install-cvmfs-linux.sh @@ -13,7 +13,12 @@ dpkg -i ${APT_ARCHIVES}/cvmfs-release-latest_all.deb # Install CVMFS and config package apt-get -q update -apt-get -q -y install cvmfs ${CVMFS_CONFIG_PACKAGE:-cvmfs-config-default} +if [ -z "${CVMFS_CONFIG_PACKAGE}" ]; then + apt-get -q -y install cvmfs cvmfs-config-default +else + curl -L -o ${APT_ARCHIVES}/cvmfs-config.deb ${CVMFS_CONFIG_PACKAGE} + dpkg -i ${APT_ARCHIVES}/cvmfs-config.deb +fi # Write config from environment variables mkdir -p /etc/cvmfs From f61ea44f57a88772fd4011896dad512e0c6c65f5 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 25 Aug 2025 14:50:02 +0000 Subject: [PATCH 15/21] Fix condition for installing CVMFS config package in install-cvmfs-linux.sh --- install-cvmfs-linux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-cvmfs-linux.sh b/install-cvmfs-linux.sh index ee78bff..638b2cf 100644 --- a/install-cvmfs-linux.sh +++ b/install-cvmfs-linux.sh @@ -13,7 +13,7 @@ dpkg -i ${APT_ARCHIVES}/cvmfs-release-latest_all.deb # Install CVMFS and config package apt-get -q update -if [ -z "${CVMFS_CONFIG_PACKAGE}" ]; then +if [ "${CVMFS_CONFIG_PACKAGE}" == "cvmfs-config-default" ]; then apt-get -q -y install cvmfs cvmfs-config-default else curl -L -o ${APT_ARCHIVES}/cvmfs-config.deb ${CVMFS_CONFIG_PACKAGE} From 6ef171440029070232f21eae77f32dd420c20964 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 25 Aug 2025 13:13:26 -0500 Subject: [PATCH 16/21] Update create-config.sh to remove sudo usage Removed 'sudo' from mkdir and echo commands for creating default.local file. --- create-config.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/create-config.sh b/create-config.sh index 8857c8f..d668e3d 100755 --- a/create-config.sh +++ b/create-config.sh @@ -79,11 +79,11 @@ declare -a vars=(CVMFS_ALIEN_CACHE CVMFS_WORKSPACE ) -sudo mkdir -p /etc/cvmfs -echo "# cvmfs default.local file installed with cvmfs-contrib/github-action-cvmfs" | sudo tee /etc/cvmfs/default.local +mkdir -p /etc/cvmfs +echo "# cvmfs default.local file installed with cvmfs-contrib/github-action-cvmfs" | tee /etc/cvmfs/default.local for var_name in "${vars[@]}" do if [ ! -z "$(eval "echo \$$var_name")" ]; then - echo "$var_name='$(eval "echo \$$var_name")'" | sudo tee -a /etc/cvmfs/default.local + echo "$var_name='$(eval "echo \$$var_name")'" | tee -a /etc/cvmfs/default.local fi done From 86259e90ddca1028bdb0a94f15863e8663230d41 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 25 Aug 2025 23:34:43 +0000 Subject: [PATCH 17/21] Move GitHub Copilot instruction and devcontainer feature documentation --- COPILOT_INSTRUCTION.md => .github/COPILOT_INSTRUCTION.md | 0 src/cvmfs/README.md => README.devcontainer.md | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename COPILOT_INSTRUCTION.md => .github/COPILOT_INSTRUCTION.md (100%) rename src/cvmfs/README.md => README.devcontainer.md (100%) diff --git a/COPILOT_INSTRUCTION.md b/.github/COPILOT_INSTRUCTION.md similarity index 100% rename from COPILOT_INSTRUCTION.md rename to .github/COPILOT_INSTRUCTION.md diff --git a/src/cvmfs/README.md b/README.devcontainer.md similarity index 100% rename from src/cvmfs/README.md rename to README.devcontainer.md From 4ab8ca6627ec9dd11e47f0bb2afc205b5f8e231d Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 25 Aug 2025 23:35:48 +0000 Subject: [PATCH 18/21] Also mount requested repos in linux --- install-cvmfs-linux.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/install-cvmfs-linux.sh b/install-cvmfs-linux.sh index 638b2cf..05484cd 100644 --- a/install-cvmfs-linux.sh +++ b/install-cvmfs-linux.sh @@ -33,4 +33,10 @@ done # Configure CVMFS bash create-config.sh -bash setup-cvmfs-config.sh \ No newline at end of file +bash setup-cvmfs-config.sh + +# Mount repositories +for repo in $(echo ${CVMFS_REPOSITORIES} | sed "s/,/ /g") +do + sudo mount -t cvmfs ${repo} /cvmfs/${repo} +done From 1398c01de2020fa0296c5a00386bdc78bc8b9859 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 25 Aug 2025 23:36:53 +0000 Subject: [PATCH 19/21] Move devcontainer feature to top level --- devcontainer-feature.json | 24 ++++++++++++++++++++++++ src/cvmfs/devcontainer-feature.json | 19 ------------------- src/cvmfs/install.sh | 6 ------ 3 files changed, 24 insertions(+), 25 deletions(-) create mode 100644 devcontainer-feature.json delete mode 100644 src/cvmfs/devcontainer-feature.json delete mode 100644 src/cvmfs/install.sh diff --git a/devcontainer-feature.json b/devcontainer-feature.json new file mode 100644 index 0000000..0cc1901 --- /dev/null +++ b/devcontainer-feature.json @@ -0,0 +1,24 @@ +{ + "name": "CVMFS", + "id": "cvmfs", + "version": "1.4.3", + "description": "Installs CVMFS client", + "options": { + "CVMFS_REPOSITORIES": { + "type": "string", + "default": "sft.cern.ch", + "description": "Comma-separated list of fully qualified repository names that shall be mountable under /cvmfs" + }, + "CVMFS_CONFIG_PACKAGE": { + "type": "string", + "default": "cvmfs-config-default", + "description": "URL to the cvmfs config package to install" + }, + "CVMFS_HTTP_PROXY": { + "type": "string", + "default": "DIRECT", + "description": "Chain of HTTP proxy groups used by CernVM-FS. Defaults to DIRECT)" + } + }, + "entrypoint": "install-cvmfs-linux.sh" +} diff --git a/src/cvmfs/devcontainer-feature.json b/src/cvmfs/devcontainer-feature.json deleted file mode 100644 index 64fb234..0000000 --- a/src/cvmfs/devcontainer-feature.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "CVMFS", - "id": "cvmfs", - "version": "1.0.0", - "description": "Installs CVMFS client", - "options": { - "CVMFS_REPOSITORIES": { - "type": "string", - "default": "alice.cern.ch,atlas.cern.ch,cms.cern.ch,lhcb.cern.ch", - "description": "CVMFS repositories to enable" - }, - "CVMFS_CONFIG_REPO": { - "type": "string", - "default": "", - "description": "URL of a repository with CVMFS config files" - } - }, - "entrypoint": "install.sh" -} diff --git a/src/cvmfs/install.sh b/src/cvmfs/install.sh deleted file mode 100644 index 45d9e07..0000000 --- a/src/cvmfs/install.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -set -e - -# Use the shared core installer for Linux (relative path for feature packaging) -bash "$(dirname "$0")/../../install-cvmfs-linux.sh" \ No newline at end of file From 7cbd63aa1ecc157de680c1ec4362eb0b56d212fc Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 25 Aug 2025 23:38:10 +0000 Subject: [PATCH 20/21] Enhance publish workflow to include version input and update devcontainer-feature.json --- .github/workflows/publish-feature.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-feature.yml b/.github/workflows/publish-feature.yml index deea1b3..fa9995a 100644 --- a/.github/workflows/publish-feature.yml +++ b/.github/workflows/publish-feature.yml @@ -1,6 +1,12 @@ name: Publish Devcontainer Feature on: + workflow_call: + inputs: + version: + description: 'The version to publish' + required: true + type: string release: types: [created] @@ -17,5 +23,18 @@ jobs: - name: Login to GitHub Container Registry run: echo "${{ secrets.WRITE_PACKAGES_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + - name: Add version to environment + run: | + VERSION="${{ inputs.version || github.ref_name }}" + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Add version to devcontainer-feature.json + run: | + jq --arg VERSION "${{ env.VERSION }}" '.version = $VERSION' src/cvmfs/devcontainer-feature.json > tmp.json + mv tmp.json src/cvmfs/devcontainer-feature.json + - name: Publish Devcontainer Feature - run: devcontainer features publish src/cvmfs --namespace cvmfs-contrib + run: devcontainer features publish --namespace ${{ github.actor }}/${{ github.repository }} . + + - name: Build Devcontainer Feature + run: devcontainer build --workspace-folder . --image-name test-cvmfs-feature --additional-features ghcr.io/${{ github.actor }}/${{ github.repository }}/cvmfs:${{ env.VERSION }} From 8751251aa1666b808e7c18da56ad3ec7f649f10d Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 25 Aug 2025 23:44:46 +0000 Subject: [PATCH 21/21] Add devcontainer configuration for CVMFS Action Test --- .devcontainer/devcontainer-with-cvmfs.json | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .devcontainer/devcontainer-with-cvmfs.json diff --git a/.devcontainer/devcontainer-with-cvmfs.json b/.devcontainer/devcontainer-with-cvmfs.json new file mode 100644 index 0000000..5f61422 --- /dev/null +++ b/.devcontainer/devcontainer-with-cvmfs.json @@ -0,0 +1,8 @@ +{ + "name": "CVMFS Action Test", + "image": "mcr.microsoft.com/devcontainers/base:ubuntu", + "features": { + "ghcr.io/cvmfs-contrib/github-action-cvmfs/cvmfs": {} + }, + "forwardPorts": [] +} \ No newline at end of file