From fefd1fa8e848a384de0bf063bcbb0c8a4e892bd8 Mon Sep 17 00:00:00 2001 From: Thomas Hobson <git@hexf.me> Date: Sun, 25 Apr 2021 13:09:08 +1200 Subject: [PATCH 01/20] pony needs the right extension --- packages/ponylang/0.39.0/compile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ponylang/0.39.0/compile b/packages/ponylang/0.39.0/compile index b0538df..f00b22c 100644 --- a/packages/ponylang/0.39.0/compile +++ b/packages/ponylang/0.39.0/compile @@ -1,5 +1,5 @@ #!/usr/bin/env bash # Compile pony file(s) -rename 's/$/\.pong/' "$@" # Add .pony extension +rename 's/$/\.pony/' "$@" # Add .pony extension ponyc -b out \ No newline at end of file From 3b25ec438634f10de4c35d1cbb3a5741575af444 Mon Sep 17 00:00:00 2001 From: Thomas Hobson <git@hexf.me> Date: Sun, 25 Apr 2021 13:10:18 +1200 Subject: [PATCH 02/20] update test script --- packages/test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/test.sh b/packages/test.sh index 9f30237..9ba39ba 100755 --- a/packages/test.sh +++ b/packages/test.sh @@ -5,7 +5,8 @@ AUTH_HEADER="Authorization: $API_KEY" for test_file in */*/test.* do IFS='/' read -ra test_parts <<< "$test_file" - language=${test_parts[0]} + IFS='.' read -ra file_parts <<< "$(basename $test_file)" + language=${file_parts[1]} lang_ver=${test_parts[1]} test_src=$(python3 -c "import json; print(json.dumps(open('$test_file').read()))") From ccc1e4c08b4032cad44387aaf7af9400fc5befc8 Mon Sep 17 00:00:00 2001 From: Thomas Hobson <git@hexf.me> Date: Sun, 25 Apr 2021 13:11:33 +1200 Subject: [PATCH 03/20] Add provides key to some languages Provides key allows 1 package to provide multiple languages Expect an API update to work with these new packages --- packages/gcc/10.2.0/compile | 10 +++++----- packages/gcc/10.2.0/metadata.json | 15 ++++++++++++++- packages/nasm/2.15.5/compile | 4 ++-- packages/nasm/2.15.5/metadata.json | 11 ++++++++++- packages/node/15.10.0/metadata.json | 7 ++++++- 5 files changed, 37 insertions(+), 10 deletions(-) diff --git a/packages/gcc/10.2.0/compile b/packages/gcc/10.2.0/compile index 8ef8ec5..c2957d8 100644 --- a/packages/gcc/10.2.0/compile +++ b/packages/gcc/10.2.0/compile @@ -3,21 +3,21 @@ # Put instructions to compile source code, remove this file if the language does not require this stage -case "${PISTON_ALIAS}" in - gcc | c) +case "${PISTON_LANGUAGE}" in + c) rename 's/$/\.c/' "$@" # Add .c extension gcc -std=c11 *.c -lm ;; - g++ | c++ | cpp) + c++) rename 's/$/\.cpp/' "$@" # Add .cpp extension g++ -std=c++17 *.cpp ;; - gdc | d) + d) rename 's/$/\.d/' "$@" # Add .d extension gdc *.d ;; *) - echo "How did you get here? (${PISTON_ALIAS})" + echo "How did you get here? (${PISTON_LANGUAGE})" exit 1 ;; esac diff --git a/packages/gcc/10.2.0/metadata.json b/packages/gcc/10.2.0/metadata.json index 6e211f6..800e652 100644 --- a/packages/gcc/10.2.0/metadata.json +++ b/packages/gcc/10.2.0/metadata.json @@ -1,5 +1,18 @@ { "language": "gcc", "version": "10.2.0", - "aliases": ["c", "g++", "c++", "cpp", "gdc", "d"] + "provides": [ + { + "language":"c", + "aliases": ["gcc"] + }, + { + "language": "c++", + "aliases": ["cpp", "g++"] + }, + { + "language": "d", + "aliases": ["gdc"] + } + ] } diff --git a/packages/nasm/2.15.5/compile b/packages/nasm/2.15.5/compile index e481319..f133a67 100644 --- a/packages/nasm/2.15.5/compile +++ b/packages/nasm/2.15.5/compile @@ -3,7 +3,7 @@ # Put instructions to compile source code, remove this file if the language does not require this stage -case "${PISTON_ALIAS}" in +case "${PISTON_LANGUAGE}" in nasm) nasm -f elf32 -o binary.o "$@" ld -m elf_i386 binary.o -o binary @@ -13,7 +13,7 @@ case "${PISTON_ALIAS}" in ld -m elf_x86_64 binary.o -o binary ;; *) - echo "How did you get here? (${PISTON_ALIAS})" + echo "How did you get here? (${PISTON_LANGUAGE})" exit 1 ;; esac diff --git a/packages/nasm/2.15.5/metadata.json b/packages/nasm/2.15.5/metadata.json index 9f8a384..80a5150 100644 --- a/packages/nasm/2.15.5/metadata.json +++ b/packages/nasm/2.15.5/metadata.json @@ -1,5 +1,14 @@ { "language": "nasm", "version": "2.15.5", - "aliases": ["nasm64"] + "provides": [ + { + "language": "nasm", + "aliases": ["asm", "nasm32"] + }, + { + "language": "nasm64", + "aliases": ["asm64"] + } + ] } diff --git a/packages/node/15.10.0/metadata.json b/packages/node/15.10.0/metadata.json index 2f601d1..3675016 100644 --- a/packages/node/15.10.0/metadata.json +++ b/packages/node/15.10.0/metadata.json @@ -1,5 +1,10 @@ { "language": "node", "version": "15.10.0", - "aliases": ["node-javascript", "node-js", "javascript", "js"] + "provides": [ + { + "language": "javascript", + "aliases": ["node-javascript", "node-js", "javascript", "js"] + } + ] } From 5f267a98b4a4815d7e0636d4e181aea170f78e07 Mon Sep 17 00:00:00 2001 From: Dan Vargas <10914883+dvargas46@users.noreply.github.com> Date: Sat, 24 Apr 2021 20:45:43 -0500 Subject: [PATCH 04/20] pkg(scala-3.0.0): Quick fix for filename issue (#228) --- packages/scala/3.0.0/run | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/scala/3.0.0/run b/packages/scala/3.0.0/run index f8ff8a1..1d92acc 100644 --- a/packages/scala/3.0.0/run +++ b/packages/scala/3.0.0/run @@ -1,4 +1,7 @@ #!/usr/bin/env bash # Put instructions to run the runtime -scala "$@" +mv $1 $1.scala +filename=$1.scala +shift +scala $filename "$@" From 77ad337e1de686907522863c0b24d26323a45f43 Mon Sep 17 00:00:00 2001 From: Thomas Hobson <git@hexf.me> Date: Sun, 25 Apr 2021 13:56:16 +1200 Subject: [PATCH 05/20] wrapper script for cli --- piston | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 piston diff --git a/piston b/piston new file mode 100755 index 0000000..94b0fe1 --- /dev/null +++ b/piston @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +node cli/index.js "$@" \ No newline at end of file From a328b3eedaa57f806f807b63ea3c013338960a1d Mon Sep 17 00:00:00 2001 From: Thomas Hobson <git@hexf.me> Date: Sun, 25 Apr 2021 15:02:57 +1200 Subject: [PATCH 06/20] better support for multiple languages per package --- api/src/executor/job.js | 5 ++--- api/src/index.js | 5 +++-- api/src/ppman/package.js | 4 ++-- api/src/runtime.js | 46 +++++++++++++++++++++++++++++++++------- 4 files changed, 45 insertions(+), 15 deletions(-) diff --git a/api/src/executor/job.js b/api/src/executor/job.js index f7adec2..63122d0 100644 --- a/api/src/executor/job.js +++ b/api/src/executor/job.js @@ -17,7 +17,7 @@ let gid = 0; class Job { - constructor({ runtime, files, args, stdin, timeouts, alias }) { + constructor({ runtime, files, args, stdin, timeouts }) { this.uuid = uuidv4(); this.runtime = runtime; this.files = files.map((file,i) => ({ @@ -28,7 +28,6 @@ class Job { this.args = args; this.stdin = stdin; this.timeouts = timeouts; - this.alias = alias; this.uid = config.runner_uid_min + uid; this.gid = config.runner_gid_min + gid; @@ -90,7 +89,7 @@ class Job { const proc = cp.spawn(proc_call[0], proc_call.splice(1) ,{ env: { ...this.runtime.env_vars, - PISTON_ALIAS: this.alias + PISTON_LANGUAGE: this.runtime.language }, stdio: 'pipe', cwd: this.dir, diff --git a/api/src/index.js b/api/src/index.js index 94840ad..fcf82d6 100644 --- a/api/src/index.js +++ b/api/src/index.js @@ -50,7 +50,7 @@ const app = express(); .flat() .filter(pkg => fss.exists_sync(path.join(pkg, globals.pkg_installed_file))); - installed_languages.forEach(pkg => new runtime.Runtime(pkg)); + installed_languages.forEach(pkg => runtime.load_package(pkg)); logger.info('Starting API Server'); logger.debug('Constructing Express App'); @@ -100,7 +100,8 @@ const app = express(); return { language: rt.language, version: rt.version.raw, - aliases: rt.aliases + aliases: rt.aliases, + runtime: rt.runtime }; }); diff --git a/api/src/ppman/package.js b/api/src/ppman/package.js index ee12bd9..0e3c994 100644 --- a/api/src/ppman/package.js +++ b/api/src/ppman/package.js @@ -85,7 +85,7 @@ class Package { }); logger.debug('Registering runtime'); - new runtime.Runtime(this.install_path); + runtime.load_package(this.install_path); logger.debug('Caching environment'); const get_env_command = `cd ${this.install_path}; source environment; env`; @@ -136,7 +136,7 @@ class Package { logger.info(`Uninstalling ${this.language}-${this.version.raw}`); logger.debug("Finding runtime") - const found_runtime = runtime.get_latest_runtime_matching_language_version(this.language, this.version.raw); + const found_runtime = runtime.get_runtime_by_name_and_version(this.language, this.version.raw); if(!found_runtime){ logger.error(`Uninstalling ${this.language}-${this.version.raw} failed: Not installed`) diff --git a/api/src/runtime.js b/api/src/runtime.js index c5239c3..673c0d8 100644 --- a/api/src/runtime.js +++ b/api/src/runtime.js @@ -9,17 +9,21 @@ const runtimes = []; class Runtime { - constructor(package_dir){ + constructor({language, version, aliases, pkgdir, runtime}){ + this.language = language; + this.version = version; + this.aliases = aliases; + this.pkgdir = pkgdir; + this.runtime = runtime; + } + + static load_package(package_dir){ let info = JSON.parse( fss.read_file_sync(path.join(package_dir, 'pkg-info.json')) ); - const { language, version, build_platform, aliases } = info; - - this.pkgdir = package_dir; - this.language = language; - this.version = semver.parse(version); - this.aliases = aliases; + let { language, version, build_platform, aliases, provides } = info; + version = semver.parse(version); if (build_platform !== globals.platform) { logger.warn( @@ -28,9 +32,29 @@ class Runtime { ); } + if(provides){ + // Multiple languages in 1 package + provides.forEach(lang => { + runtimes.push(new Runtime({ + language: lang.language, + aliases: lang.aliases, + version, + pkgdir: package_dir, + runtime: language + })); + }); + }else{ + runtimes.push(new Runtime({ + language, + version, + aliases, + pkgdir: package_dir + })) + } + logger.debug(`Package ${language}-${version} was loaded`); - runtimes.push(this); + } get compiled() { @@ -79,3 +103,9 @@ module.exports.get_latest_runtime_matching_language_version = function(lang, ver return module.exports.get_runtimes_matching_language_version(lang, ver) .sort((a,b) => semver.rcompare(a.version, b.version))[0]; }; + +module.exports.get_runtime_by_name_and_version = function(runtime, ver){ + return runtimes.find(rt => (rt.runtime == runtime || (rt.runtime === undefined && rt.language == lang)) && semver.satisfies(rt.version, ver)); +} + +module.exports.load_package = Runtime.load_package; \ No newline at end of file From ccd6baf11ac0d17e34172371c9c2dcfc2fdfa5c4 Mon Sep 17 00:00:00 2001 From: Thomas Hobson <git@hexf.me> Date: Sun, 25 Apr 2021 15:04:01 +1200 Subject: [PATCH 07/20] enhance piston script --- piston | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/piston b/piston index 94b0fe1..405fa9b 100755 --- a/piston +++ b/piston @@ -1,2 +1,23 @@ #!/usr/bin/env bash -node cli/index.js "$@" \ No newline at end of file + +case $1 in + dev) + shift + docker-compose -f docker-compose.dev.yaml "$@" + ;; + prod) + shift + docker-compose -f docker-compose.yaml "$@" + ;; + update) + git pull + docker-compose build api + docker-compose up api -d + ;; + clean-pkgs) + git clean -fqXd packages + ;; + *) + node cli/index.js "$@" + ;; +esac \ No newline at end of file From 35c807dac19c994b17422ea938e2275729350ff0 Mon Sep 17 00:00:00 2001 From: Thomas Hobson <git@hexf.me> Date: Sun, 25 Apr 2021 15:05:05 +1200 Subject: [PATCH 08/20] correct arg order --- piston | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/piston b/piston index 405fa9b..8fafd98 100755 --- a/piston +++ b/piston @@ -12,7 +12,7 @@ case $1 in update) git pull docker-compose build api - docker-compose up api -d + docker-compose up -d api ;; clean-pkgs) git clean -fqXd packages From e96be60e7acd9dd7c69105ff183aa3a59b5dec77 Mon Sep 17 00:00:00 2001 From: Thomas Hobson <git@hexf.me> Date: Sun, 25 Apr 2021 15:05:27 +1200 Subject: [PATCH 09/20] pull for prod, not rebuild --- piston | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/piston b/piston index 8fafd98..f58fd78 100755 --- a/piston +++ b/piston @@ -11,7 +11,7 @@ case $1 in ;; update) git pull - docker-compose build api + docker-compose pull api docker-compose up -d api ;; clean-pkgs) From 6d2814880f49e1eaff487f4abdaf2332084291c5 Mon Sep 17 00:00:00 2001 From: Dan Vargas <10914883+dvargas46@users.noreply.github.com> Date: Sat, 24 Apr 2021 22:09:13 -0500 Subject: [PATCH 10/20] pkg(go-1.16.2): quick fix for filename issue (#229) --- packages/go/1.16.2/run | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/go/1.16.2/run b/packages/go/1.16.2/run index 09656af..da31af3 100644 --- a/packages/go/1.16.2/run +++ b/packages/go/1.16.2/run @@ -1,3 +1,6 @@ #!/usr/bin/env bash -GOCACHE=$PWD go run "$@" +mv $1 $1.go +filename=$1.go +shift +GOCACHE=$PWD go run $filename "$@" From 30fa1d1425eb7b2b1e1cd66fc594b5279f6933bc Mon Sep 17 00:00:00 2001 From: Thomas Hobson <git@hexf.me> Date: Sun, 25 Apr 2021 15:11:32 +1200 Subject: [PATCH 11/20] use correct var name --- api/src/runtime.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/runtime.js b/api/src/runtime.js index 673c0d8..27b60e5 100644 --- a/api/src/runtime.js +++ b/api/src/runtime.js @@ -105,7 +105,7 @@ module.exports.get_latest_runtime_matching_language_version = function(lang, ver }; module.exports.get_runtime_by_name_and_version = function(runtime, ver){ - return runtimes.find(rt => (rt.runtime == runtime || (rt.runtime === undefined && rt.language == lang)) && semver.satisfies(rt.version, ver)); + return runtimes.find(rt => (rt.runtime == runtime || (rt.runtime === undefined && rt.language == runtime)) && semver.satisfies(rt.version, ver)); } module.exports.load_package = Runtime.load_package; \ No newline at end of file From 258539d593321212d8b3a272ddf61bf1ed6142b6 Mon Sep 17 00:00:00 2001 From: Thomas Hobson <git@hexf.me> Date: Sun, 25 Apr 2021 15:24:18 +1200 Subject: [PATCH 12/20] gawk fix gawk is not compile, and should display as awk --- packages/gawk/5.1.0/compile | 3 --- packages/gawk/5.1.0/metadata.json | 7 ++++++- 2 files changed, 6 insertions(+), 4 deletions(-) delete mode 100644 packages/gawk/5.1.0/compile diff --git a/packages/gawk/5.1.0/compile b/packages/gawk/5.1.0/compile deleted file mode 100644 index e37a74c..0000000 --- a/packages/gawk/5.1.0/compile +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -# Put instructions to compile source code, remove this file if the language does not require this stage diff --git a/packages/gawk/5.1.0/metadata.json b/packages/gawk/5.1.0/metadata.json index e22b5d1..2d14517 100644 --- a/packages/gawk/5.1.0/metadata.json +++ b/packages/gawk/5.1.0/metadata.json @@ -1,5 +1,10 @@ { "language": "gawk", "version": "5.1.0", - "aliases": ["awk"] + "provides": [ + { + "language": "awk", + "alias": ["gawk"] + } + ] } From 7e1960302d18e03b3f9fadb2554aa461a6fefe20 Mon Sep 17 00:00:00 2001 From: Thomas Hobson <git@hexf.me> Date: Sun, 25 Apr 2021 15:36:38 +1200 Subject: [PATCH 13/20] d: replace .code with .d --- packages/gcc/10.2.0/compile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gcc/10.2.0/compile b/packages/gcc/10.2.0/compile index c2957d8..b381537 100644 --- a/packages/gcc/10.2.0/compile +++ b/packages/gcc/10.2.0/compile @@ -13,7 +13,7 @@ case "${PISTON_LANGUAGE}" in g++ -std=c++17 *.cpp ;; d) - rename 's/$/\.d/' "$@" # Add .d extension + rename 's/.code$/\.d/' "$@" # Add .d extension gdc *.d ;; *) From 09e347a0987277bc1e27dbce3cb184b340dd7558 Mon Sep 17 00:00:00 2001 From: Dan Vargas <10914883+dvargas46@users.noreply.github.com> Date: Sat, 24 Apr 2021 23:21:57 -0500 Subject: [PATCH 14/20] pkg(mono-6.12.0): filename fixes (#230) * pkg(mono-6.12.0): filename fixes * pkg(mono-6.12.0): compile cs files * pkg(mono-6.12.0): add provides in metadata --- packages/mono/6.12.0/compile | 3 ++- packages/mono/6.12.0/environment | 2 +- packages/mono/6.12.0/metadata.json | 7 ++++++- packages/mono/6.12.0/run | 3 +-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/mono/6.12.0/compile b/packages/mono/6.12.0/compile index 746c05e..8728714 100644 --- a/packages/mono/6.12.0/compile +++ b/packages/mono/6.12.0/compile @@ -1,3 +1,4 @@ #!/bin/bash -csc "$@" \ No newline at end of file +rename 's/$/\.cs/' "$@" # Add .cs extension +csc -out:out *.cs diff --git a/packages/mono/6.12.0/environment b/packages/mono/6.12.0/environment index 03bbb35..bd0ff98 100644 --- a/packages/mono/6.12.0/environment +++ b/packages/mono/6.12.0/environment @@ -1 +1 @@ -export PATH=$PWD/mono-6.12.0:$PATH \ No newline at end of file +export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/mono/6.12.0/metadata.json b/packages/mono/6.12.0/metadata.json index 85679bf..a053884 100644 --- a/packages/mono/6.12.0/metadata.json +++ b/packages/mono/6.12.0/metadata.json @@ -1,5 +1,10 @@ { "language": "mono", "version": "6.12.0", - "aliases": ["csharp", "cs"] + "provides": [ + { + "language": "csharp", + "aliases": ["mono", "mono-csharp", "mono-c#", "mono-cs", "c#", "cs"] + } + ] } diff --git a/packages/mono/6.12.0/run b/packages/mono/6.12.0/run index 557ce76..5a2e015 100644 --- a/packages/mono/6.12.0/run +++ b/packages/mono/6.12.0/run @@ -1,5 +1,4 @@ #!/bin/bash -CODE=${1/cs/exe} shift -mono $CODE "$@" \ No newline at end of file +mono out "$@" \ No newline at end of file From 8e7279ce6986b609f27a25d36dca9f3b544aece8 Mon Sep 17 00:00:00 2001 From: Thomas Hobson <git@hexf.me> Date: Sun, 25 Apr 2021 16:36:48 +1200 Subject: [PATCH 15/20] fix gawk metadata --- packages/gawk/5.1.0/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gawk/5.1.0/metadata.json b/packages/gawk/5.1.0/metadata.json index 2d14517..1ae8c16 100644 --- a/packages/gawk/5.1.0/metadata.json +++ b/packages/gawk/5.1.0/metadata.json @@ -4,7 +4,7 @@ "provides": [ { "language": "awk", - "alias": ["gawk"] + "aliases": ["gawk"] } ] } From 45eb4c799d096095d19e9924857cb81c4f54480b Mon Sep 17 00:00:00 2001 From: Thomas Hobson <git@hexf.me> Date: Sun, 25 Apr 2021 16:37:05 +1200 Subject: [PATCH 16/20] dont crash if there are no aliases --- api/src/runtime.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/runtime.js b/api/src/runtime.js index 27b60e5..43713ee 100644 --- a/api/src/runtime.js +++ b/api/src/runtime.js @@ -12,7 +12,7 @@ class Runtime { constructor({language, version, aliases, pkgdir, runtime}){ this.language = language; this.version = version; - this.aliases = aliases; + this.aliases = aliases || []; this.pkgdir = pkgdir; this.runtime = runtime; } From 0e6f082f5f2c1eca346fb2d2f26fe54bf342853c Mon Sep 17 00:00:00 2001 From: Thomas Hobson <git@hexf.me> Date: Sun, 25 Apr 2021 16:39:33 +1200 Subject: [PATCH 17/20] use correct container name in index --- repo/mkindex.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repo/mkindex.sh b/repo/mkindex.sh index 082423e..c93b444 100755 --- a/repo/mkindex.sh +++ b/repo/mkindex.sh @@ -1,4 +1,4 @@ -BASEURL=http://piston_fs_repo:8000/ +BASEURL=http://repo:8000/ i=0 From f590f85d6de8080e87d1df42e0e8e5b5315948c4 Mon Sep 17 00:00:00 2001 From: Thomas Hobson <git@hexf.me> Date: Sun, 25 Apr 2021 16:41:02 +1200 Subject: [PATCH 18/20] unbreak CI --- .github/workflows/package-pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/package-pr.yaml b/.github/workflows/package-pr.yaml index fd3d91e..2405aa6 100644 --- a/.github/workflows/package-pr.yaml +++ b/.github/workflows/package-pr.yaml @@ -88,7 +88,7 @@ jobs: - name: Run tests run: | ls -la - docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' -d --name piston_fs_repo docker.pkg.github.com/engineer-man/piston/repo-builder --no-build + docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' -d --name repo docker.pkg.github.com/engineer-man/piston/repo-builder --no-build docker run --network container:piston_fs_repo -v $(pwd)'/data:/piston' -d --name api docker.pkg.github.com/engineer-man/piston/api echo Waiting for API to start.. docker run --network container:api appropriate/curl -s --retry 10 --retry-connrefused http://localhost:2000/runtimes From 1e3b01283ebce57f9763c98832048df631c01dcd Mon Sep 17 00:00:00 2001 From: Thomas Hobson <git@hexf.me> Date: Sun, 25 Apr 2021 16:43:57 +1200 Subject: [PATCH 19/20] ci fix --- .github/workflows/package-pr.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/package-pr.yaml b/.github/workflows/package-pr.yaml index 2405aa6..db016b2 100644 --- a/.github/workflows/package-pr.yaml +++ b/.github/workflows/package-pr.yaml @@ -89,15 +89,15 @@ jobs: run: | ls -la docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' -d --name repo docker.pkg.github.com/engineer-man/piston/repo-builder --no-build - docker run --network container:piston_fs_repo -v $(pwd)'/data:/piston' -d --name api docker.pkg.github.com/engineer-man/piston/api + docker run --network container:repo -v $(pwd)'/data:/piston' -d --name api docker.pkg.github.com/engineer-man/piston/api echo Waiting for API to start.. docker run --network container:api appropriate/curl -s --retry 10 --retry-connrefused http://localhost:2000/runtimes echo Waiting for Index to start.. - docker run --network container:piston_fs_repo appropriate/curl -s --retry 999 --retry-max-time 0 --retry-connrefused http://localhost:8000/index + docker run --network container:repo appropriate/curl -s --retry 999 --retry-max-time 0 --retry-connrefused http://localhost:8000/index echo Adjusting index - sed -i 's/piston_fs_repo/localhost/g' repo/index + sed -i 's/repo/localhost/g' repo/index echo Listing Packages PACKAGES_JSON=$(docker run --network container:api appropriate/curl -s http://localhost:2000/packages) From 5f97005a9ae6539163ef41c137bf8b040f0f2f17 Mon Sep 17 00:00:00 2001 From: Victor Frazao <31864869+vfrazao-ns1@users.noreply.github.com> Date: Sun, 25 Apr 2021 00:55:39 -0400 Subject: [PATCH 20/20] Fixes nasm32 - adds 32bit arch to seccomp filter (#231) --- api/src/nosocket/nosocket.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/api/src/nosocket/nosocket.c b/api/src/nosocket/nosocket.c index 03909ee..4efab88 100644 --- a/api/src/nosocket/nosocket.c +++ b/api/src/nosocket/nosocket.c @@ -24,6 +24,22 @@ int main(int argc, char *argv[]) return 1; } + // Add 32 bit and 64 bit architectures to seccomp filter + int rc; + uint32_t arch[] = {SCMP_ARCH_X86_64, SCMP_ARCH_X86, SCMP_ARCH_X32}; + // We first remove the existing arch, otherwise our subsequent call to add + // it will fail + seccomp_arch_remove(ctx, seccomp_arch_native()); + for (int i = 0; i < sizeof(arch) / sizeof(arch[0]); i++) + { + rc = seccomp_arch_add(ctx, arch[i]); + if (rc != 0) + { + fprintf(stderr, "Unable to add arch: %d\n", arch[i]); + return 1; + } + } + // Add a seccomp rule to the syscall blacklist - blacklist the socket syscall if (seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EACCES), SCMP_SYS(socket), 0) < 0) {