Skip to content

Commit

Permalink
Add option to specify which services to start
Browse files Browse the repository at this point in the history
  • Loading branch information
jennydaman committed Jul 27, 2024
1 parent 5368632 commit 111618c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
8 changes: 6 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
name: "ChRIS Backend"
description: "Bring up ephemeral instances of CUBE, pfcon, pman, pfioh, swift, and ChRIS_store"
name: "miniChRIS in Docker"
description: "Bring up a local ChRIS backend."
author: "FNNDSC"
inputs:
plugins:
description: "List of plugins to register, separated by whitespace."
required: false
default: ''
services:
description: "Manually specify list of services to start, separated by whitespace. Setting this option can save time and memory."
required: false
default: ''

runs:
using: node20
Expand Down
10 changes: 7 additions & 3 deletions minichris.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

if [ "$CI" = "true" ]; then
notty='-T'
Expand All @@ -8,5 +8,9 @@ fi
cd "$(dirname "$(readlink -f "$0")")"

set -ex
docker compose up -d
exec docker compose run --rm $notty chrisomatic
docker compose up -d "$@"

# if chris is running, run chrisomatic
if [ -n "$(docker compose ps chris -q)" ]; then
docker compose run --rm $notty chrisomatic
fi
2 changes: 1 addition & 1 deletion unmake.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# change to directory where this script lives
cd "$(dirname "$(readlink -f "$0")")"
Expand Down
17 changes: 15 additions & 2 deletions wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,27 @@ function main() {
setIsPost();
}

const script = path.join(__dirname, IS_POST ? 'unmake.sh' : 'minichris.sh');
execFileSync(script, { stdio: 'inherit' });
const scriptName = IS_POST ? 'unmake.sh' : 'minichris.sh';
runScriptHere(scriptName, getInputServices());
}

function runScriptHere(fileName, args) {
const script = path.join(__dirname, fileName);
execFileSync(script, args, { stdio: 'inherit' });
}

function setIsPost() {
fs.appendFileSync(process.env['GITHUB_STATE'], 'isPost=true\n');
}

function getInputServices() {
const inputServices = process.env['INPUT_SERVICES'];
if (inputServices) {
return inputServices.split(/\s+/);
}
return [];
}

function test() {
console.log('running unit tests');

Expand Down

0 comments on commit 111618c

Please sign in to comment.