From 0e759c27292f00459f6fa99845fb3b387d29c42a Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 12:00:43 +1300
Subject: [PATCH 01/49] ci(api): Add CI to build API container

---
 .github/workflows/api-push.yaml | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 .github/workflows/api-push.yaml

diff --git a/.github/workflows/api-push.yaml b/.github/workflows/api-push.yaml
new file mode 100644
index 0000000..ab29e03
--- /dev/null
+++ b/.github/workflows/api-push.yaml
@@ -0,0 +1,21 @@
+name: Publish API image
+on:
+  push:
+    branches:
+      - master
+      - v3
+  
+jobs:
+  push_to_registry:
+    name: Build and Push Docker image to Github Packages
+    steps:
+      - name: Check out repo
+        uses: actions/checkout@v2
+      - name: Build and push API
+        uses: docker/build-push-action@v1
+        with:
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+          registry: docker.pkg.github.com
+          repository: engineer-man/piston/piston-api
+          tag_with_ref: true
\ No newline at end of file

From 8a7d4100d7c5b72d9fe977feda84d3f2fc507ec0 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 12:02:06 +1300
Subject: [PATCH 02/49] ci(api): fix

---
 .github/workflows/api-push.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.github/workflows/api-push.yaml b/.github/workflows/api-push.yaml
index ab29e03..1030423 100644
--- a/.github/workflows/api-push.yaml
+++ b/.github/workflows/api-push.yaml
@@ -7,6 +7,7 @@ on:
   
 jobs:
   push_to_registry:
+    runs-on: ubuntu-latest
     name: Build and Push Docker image to Github Packages
     steps:
       - name: Check out repo

From 078033b4a17cee451f711369deac72cdd76ba5f8 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 12:03:22 +1300
Subject: [PATCH 03/49] ci(api): set docker build context correctly

---
 .github/workflows/api-push.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.github/workflows/api-push.yaml b/.github/workflows/api-push.yaml
index 1030423..653e642 100644
--- a/.github/workflows/api-push.yaml
+++ b/.github/workflows/api-push.yaml
@@ -15,6 +15,7 @@ jobs:
       - name: Build and push API
         uses: docker/build-push-action@v1
         with:
+          context: api
           username: ${{ github.actor }}
           password: ${{ secrets.GITHUB_TOKEN }}
           registry: docker.pkg.github.com

From b94c20b3340f6b704afc6438a512306f4f68abc4 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 12:18:37 +1300
Subject: [PATCH 04/49] ci(api): update actions to latest version

---
 .github/workflows/api-push.yaml | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/api-push.yaml b/.github/workflows/api-push.yaml
index 653e642..9055637 100644
--- a/.github/workflows/api-push.yaml
+++ b/.github/workflows/api-push.yaml
@@ -12,12 +12,18 @@ jobs:
     steps:
       - name: Check out repo
         uses: actions/checkout@v2
-      - name: Build and push API
-        uses: docker/build-push-action@v1
+      - name: Login to GitHub registry
+        uses: docker/login-action@v1
         with:
-          context: api
           username: ${{ github.actor }}
           password: ${{ secrets.GITHUB_TOKEN }}
           registry: docker.pkg.github.com
-          repository: engineer-man/piston/piston-api
-          tag_with_ref: true
\ No newline at end of file
+
+      - name: Build and push API
+        uses: docker/build-push-action@v2
+        with:
+          context: api
+          push: true
+          repository: 
+          tags: |
+            docker.pkg.github.com/engineer-man/piston-api
\ No newline at end of file

From 8cc91a375ca2998daac32a285efcdef0de302c46 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 12:20:21 +1300
Subject: [PATCH 05/49] ci(api): name correctly

---
 .github/workflows/api-push.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/api-push.yaml b/.github/workflows/api-push.yaml
index 9055637..de772f3 100644
--- a/.github/workflows/api-push.yaml
+++ b/.github/workflows/api-push.yaml
@@ -26,4 +26,4 @@ jobs:
           push: true
           repository: 
           tags: |
-            docker.pkg.github.com/engineer-man/piston-api
\ No newline at end of file
+            docker.pkg.github.com/engineer-man/piston/api
\ No newline at end of file

From 803b83693320dae16726f12275fc187ed12bbdc9 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 12:33:15 +1300
Subject: [PATCH 06/49] repo: allow build only

---
 repo/entrypoint.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/repo/entrypoint.sh b/repo/entrypoint.sh
index 54261dc..cb6d8ae 100755
--- a/repo/entrypoint.sh
+++ b/repo/entrypoint.sh
@@ -1,11 +1,13 @@
 cd /piston/packages
 
+SERVER=1
+
 for pkg in "$@"
 do
-    make -j16 $pkg.pkg.tar.gz
+    [[ "$pkg" = "--no-server" ]] && SERVER=0 || make -j16 $pkg.pkg.tar.gz
 done
 
 cd /piston/repo
 ./mkindex.sh
 
-python3 -m http.server
\ No newline at end of file
+[[ $SERVER -eq 1 ]] && python3 -m http.server
\ No newline at end of file

From bf3550200d360b6dd789892f494df26ee122b84f Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 12:34:18 +1300
Subject: [PATCH 07/49] ci(api): remove useless parameter

---
 .github/workflows/api-push.yaml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.github/workflows/api-push.yaml b/.github/workflows/api-push.yaml
index de772f3..a359ebe 100644
--- a/.github/workflows/api-push.yaml
+++ b/.github/workflows/api-push.yaml
@@ -24,6 +24,5 @@ jobs:
         with:
           context: api
           push: true
-          repository: 
           tags: |
             docker.pkg.github.com/engineer-man/piston/api
\ No newline at end of file

From 6c0d78391e43bea9715187a95b725b685ec7e395 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 12:34:54 +1300
Subject: [PATCH 08/49] ci(package): build package

---
 .github/workflows/package-pr.yaml | 65 +++++++++++++------------------
 1 file changed, 26 insertions(+), 39 deletions(-)

diff --git a/.github/workflows/package-pr.yaml b/.github/workflows/package-pr.yaml
index 245e81a..c30b054 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -15,59 +15,46 @@ jobs:
     name: Check that package builds
     runs-on: ubuntu-latest
     steps:
-      - name: Get PR Commits
-        id: 'get-pr-commits'
-        uses: tim-actions/get-pr-commits@master
-        with:
-          token: ${{ secrets.GITHUB_TOKEN }}
-      - name: Check subsystem
-        uses: tim-actions/commit-message-checker-with-regex@v0.3.1
-        with:
-          commits: ${{ steps.get-pr-commits.outputs.commits }}
-          pattern: '^[\s]*(pkg\([^:\s\n]+\))[\s]*:'
-          error: 'Your commit message must start with pkg([package])'
-      
-      - name: Get packages
-        id: 'get-packages'
-        shell: bash
-        run: |
-          COMMITS='${{ steps.get-pr-commits.outputs.commits }}'
-          PACKAGES=$(echo $COMMITS | jq .[].commit.message -r | grep -oP '^pkg\(\K[^:\h\n]+(?=\))' | sort -u)
-          echo "::set-output name=packages::$PACKAGES"
-
       - name: Checkout
         uses: actions/checkout@v2
 
       - name: Build docker containers
         run: |
           docker build -t piston_fs_repo repo
-          docker build -t piston_api api
           
       - name: Build Packages
         run: |
-          docker run -v $(pwd)'/repo:/repo' -v $(pwd)'/packages:/packages' piston_fs_repo ${{ steps.get-packages.outputs.packages }}
+          PACKAGES=$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | awk -F/ '{ print $2 "-" $3 }' | sort -u)
+          docker run -v $(pwd)'/repo:/repo' -v $(pwd)'/packages:/packages' piston_fs_repo $PACKAGES --no-server
+
+      - name: Write test config file
+        uses: DamianReeves/write-file-action
+        with:
+          path: data/config.yaml
+          contents: |
+            log_level: DEBUG
+            bind_address: 0.0.0.0:6969
+            data_directory: /piston
+            runner_uid_min: 1100
+            runner_uid_max: 1500
+            runner_gid_min: 1100
+            runner_gid_max: 1500
+            enable_unshare: false
+            output_max_size: 1024
+            max_process_count: 64
+            max_open_files: 2048
+            repo_url: http://piston_fs_repo:8000/index
+
+          write-mode: overwrite
 
       - name: Run tests
         run: |
-          docker run -p 6969:6969 -v $(pwd)'/data:/piston' -v $(pwd)'/repo:/repo' --privileged --name api piston_api & 
+          docker run -v $(pwd)'/repo:/repo' -v $(pwd)'/packages:/packages' --name piston_fs_repo piston_fs_repo $PACKAGES
+          docker run -v $(pwd)'/data:/piston' -v $(pwd)'/repo:/repo' --privileged --name api piston_api & 
           echo Waiting for API to start..
-          while [[ "$(curl -s -w '%{http_code}' http://127.0.0.1:6969/runtimes)" != "200" ]]; do sleep 5; done
-          echo Adding local repo
-          curl -s http://127.0.0.1:6969/repos -XPOST -d "slug=local&url=file:///repo/index.yaml"
+          while [[ "$(curl -s -w '%{http_code}' http://api:6969/runtimes)" != "200" ]]; do sleep 5; done
+
           echo Testing packages
-          for pkg in "$(curl -s http://127.0.0.1:6969/repos/local/packages/ | jq '.data.packages[] | "\(.language)/\(.language_version)"' -r)"
-          do
-            PKG_SLUG=${pkg/\//-}
-            PKG_NAME=$(echo $pkg | cut -d'/' -f 1)
-            PKG_VERSION=$(echo $pkg | cut -d'/' -f 2)
-            echo Installing ${PKG_SLUG}
-            curl -sXPOST http://127.0.0.1:6969/repos/local/packages/${pkg} | jq '.language' -r || exit 1
-            echo Testing ${PKG_SLUG} (using ${PKG_SLUG}.tf)
-            TEST_FILE=$(cat ${PKG_SLUG}.tf)
-            TEST_JSON=`jq -C '.language = "${PKG_NAME}" | .version = "${PKG_VERSION}" | .files=[] | .files[0]={} | .files[0].name="test" | .files[0].name.content="${TEST_FILE}" | .main = "test" | .args = [] | .stdin = "" | .compile_timeout = 10000 | .run_timeout = 3000' <<< '{}'`
-            curl -sXPOST http://127.0.0.1:6969/jobs -H 'Content-Type: application/json' -d "$TEST_JSON" > ${PKG_SLUG}.tr
-            jq '.run.stdout' ${PKG_SLUG}.tr | grep "OK" || exit 1
-          done
 
 
 

From 72617c1e2e2430e6ece2686823e4abf647fec6b4 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 12:36:19 +1300
Subject: [PATCH 09/49] ci(package): fix

---
 .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 c30b054..f92a563 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -28,7 +28,7 @@ jobs:
           docker run -v $(pwd)'/repo:/repo' -v $(pwd)'/packages:/packages' piston_fs_repo $PACKAGES --no-server
 
       - name: Write test config file
-        uses: DamianReeves/write-file-action
+        uses: damianreeves/write-file-action
         with:
           path: data/config.yaml
           contents: |

From 1bc46ed45c4dd3dc2b7448fbdea0fbcd244c6ef7 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 12:38:10 +1300
Subject: [PATCH 10/49] ci(package): version on action

---
 .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 f92a563..2abbd83 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -28,7 +28,7 @@ jobs:
           docker run -v $(pwd)'/repo:/repo' -v $(pwd)'/packages:/packages' piston_fs_repo $PACKAGES --no-server
 
       - name: Write test config file
-        uses: damianreeves/write-file-action
+        uses: DamianReeves/write-file-action@v1
         with:
           path: data/config.yaml
           contents: |

From fba88356e94a0b6e7d96387f0b8f8965dbeddc0e Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 12:39:26 +1300
Subject: [PATCH 11/49] ci(package): correct version

---
 .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 2abbd83..143e22e 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -28,7 +28,7 @@ jobs:
           docker run -v $(pwd)'/repo:/repo' -v $(pwd)'/packages:/packages' piston_fs_repo $PACKAGES --no-server
 
       - name: Write test config file
-        uses: DamianReeves/write-file-action@v1
+        uses: DamianReeves/write-file-action@v1.0
         with:
           path: data/config.yaml
           contents: |

From bebbbd8ecb446566a7cca961f41d556cab6f6bd5 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 12:44:11 +1300
Subject: [PATCH 12/49] ci(package): mount volumes in container correctly

---
 .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 143e22e..40dd1ef 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -25,7 +25,7 @@ jobs:
       - name: Build Packages
         run: |
           PACKAGES=$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | awk -F/ '{ print $2 "-" $3 }' | sort -u)
-          docker run -v $(pwd)'/repo:/repo' -v $(pwd)'/packages:/packages' piston_fs_repo $PACKAGES --no-server
+          docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' piston_fs_repo $PACKAGES --no-server
 
       - name: Write test config file
         uses: DamianReeves/write-file-action@v1.0
@@ -49,8 +49,8 @@ jobs:
 
       - name: Run tests
         run: |
-          docker run -v $(pwd)'/repo:/repo' -v $(pwd)'/packages:/packages' --name piston_fs_repo piston_fs_repo $PACKAGES
-          docker run -v $(pwd)'/data:/piston' -v $(pwd)'/repo:/repo' --privileged --name api piston_api & 
+          docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' --name piston_fs_repo piston_fs_repo $PACKAGES
+          docker run -v $(pwd)'/data:/piston' -v $(pwd)'/repo:/repo' --privileged --name docker.pkg.github.com/engineer-man/piston/api piston_api & 
           echo Waiting for API to start..
           while [[ "$(curl -s -w '%{http_code}' http://api:6969/runtimes)" != "200" ]]; do sleep 5; done
 

From 7ce8afa7f23167c1a91ff0b2f8cd6dbeeff29ad6 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 12:57:37 +1300
Subject: [PATCH 13/49] ci(repo): Initial Commit

---
 .github/workflows/repo-push.yaml | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 .github/workflows/repo-push.yaml

diff --git a/.github/workflows/repo-push.yaml b/.github/workflows/repo-push.yaml
new file mode 100644
index 0000000..4832e30
--- /dev/null
+++ b/.github/workflows/repo-push.yaml
@@ -0,0 +1,28 @@
+name: Publish Repo image
+on:
+  push:
+    branches:
+      - master
+      - v3
+  
+jobs:
+  push_to_registry:
+    runs-on: ubuntu-latest
+    name: Build and Push Docker image to Github Packages
+    steps:
+      - name: Check out repo
+        uses: actions/checkout@v2
+      - name: Login to GitHub registry
+        uses: docker/login-action@v1
+        with:
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+          registry: docker.pkg.github.com
+
+      - name: Build and push repo
+        uses: docker/build-push-action@v2
+        with:
+          context: repo
+          push: true
+          tags: |
+            docker.pkg.github.com/engineer-man/piston/repo-builder
\ No newline at end of file

From 2e20928bc8d729e1a30881b45f39f1f9773358ec Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 13:00:15 +1300
Subject: [PATCH 14/49] ci: add path filters

---
 .github/workflows/api-push.yaml  | 3 +++
 .github/workflows/repo-push.yaml | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/.github/workflows/api-push.yaml b/.github/workflows/api-push.yaml
index a359ebe..351a69e 100644
--- a/.github/workflows/api-push.yaml
+++ b/.github/workflows/api-push.yaml
@@ -4,6 +4,9 @@ on:
     branches:
       - master
       - v3
+    paths:
+      - api/**
+
   
 jobs:
   push_to_registry:
diff --git a/.github/workflows/repo-push.yaml b/.github/workflows/repo-push.yaml
index 4832e30..5516c47 100644
--- a/.github/workflows/repo-push.yaml
+++ b/.github/workflows/repo-push.yaml
@@ -4,6 +4,8 @@ on:
     branches:
       - master
       - v3
+    paths:
+      - repo/**
   
 jobs:
   push_to_registry:

From 0ff42adeaa26a261e71a06d21385638de73d401a Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 13:01:32 +1300
Subject: [PATCH 15/49] ci(package): use prebuilt images

---
 .github/workflows/package-pr.yaml | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/.github/workflows/package-pr.yaml b/.github/workflows/package-pr.yaml
index 40dd1ef..7713efe 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -17,15 +17,10 @@ jobs:
     steps:
       - name: Checkout
         uses: actions/checkout@v2
-
-      - name: Build docker containers
-        run: |
-          docker build -t piston_fs_repo repo
           
       - name: Build Packages
         run: |
-          PACKAGES=$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | awk -F/ '{ print $2 "-" $3 }' | sort -u)
-          docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' piston_fs_repo $PACKAGES --no-server
+          docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' docker.pkg.github.com/engineer-man/piston/repo-builder $(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | awk -F/ '{ print $2 "-" $3 }' | sort -u) --no-server
 
       - name: Write test config file
         uses: DamianReeves/write-file-action@v1.0
@@ -49,8 +44,8 @@ jobs:
 
       - name: Run tests
         run: |
-          docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' --name piston_fs_repo piston_fs_repo $PACKAGES
-          docker run -v $(pwd)'/data:/piston' -v $(pwd)'/repo:/repo' --privileged --name docker.pkg.github.com/engineer-man/piston/api piston_api & 
+          docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' --name piston_fs_repo docker.pkg.github.com/engineer-man/piston/repo-builder $PACKAGES
+          docker run -v $(pwd)'/data:/piston' -v $(pwd)'/repo:/repo' --privileged --name piston_api docker.pkg.github.com/engineer-man/piston/api & 
           echo Waiting for API to start..
           while [[ "$(curl -s -w '%{http_code}' http://api:6969/runtimes)" != "200" ]]; do sleep 5; done
 

From 41e036d93cd80689e2c31f06c8839be40c1331d8 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 13:02:54 +1300
Subject: [PATCH 16/49] ci(package): login to registry

---
 .github/workflows/package-pr.yaml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/.github/workflows/package-pr.yaml b/.github/workflows/package-pr.yaml
index 7713efe..0285713 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -17,6 +17,13 @@ jobs:
     steps:
       - name: Checkout
         uses: actions/checkout@v2
+      
+      - name: Login to GitHub registry
+        uses: docker/login-action@v1
+        with:
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+          registry: docker.pkg.github.com
           
       - name: Build Packages
         run: |

From 71d675f45498b3b6b79d9d95d590bdca09129a7c Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 13:06:04 +1300
Subject: [PATCH 17/49] repo: exit with zero exit code

---
 repo/entrypoint.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/repo/entrypoint.sh b/repo/entrypoint.sh
index cb6d8ae..dfe0889 100755
--- a/repo/entrypoint.sh
+++ b/repo/entrypoint.sh
@@ -10,4 +10,5 @@ done
 cd /piston/repo
 ./mkindex.sh
 
-[[ $SERVER -eq 1 ]] && python3 -m http.server
\ No newline at end of file
+[[ $SERVER -eq 1 ]] && python3 -m http.server
+exit 0
\ No newline at end of file

From 22e32be05b20bb4dda38a46f673bf1dbb0223045 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 13:21:06 +1300
Subject: [PATCH 18/49] repo: verbosity

---
 repo/Dockerfile    |  3 +--
 repo/entrypoint.sh | 28 ++++++++++++++++++++++++++--
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/repo/Dockerfile b/repo/Dockerfile
index 606b596..a326146 100644
--- a/repo/Dockerfile
+++ b/repo/Dockerfile
@@ -2,10 +2,9 @@ FROM debian:buster-slim
 
 RUN apt-get update && apt-get install -y unzip autoconf build-essential libssl-dev pkg-config zlib1g-dev libargon2-dev libsodium-dev libcurl4-openssl-dev sqlite3 libsqlite3-dev libonig-dev libxml2 libxml2-dev bc curl git linux-headers-amd64 perl xz-utils python3 python3-pip gnupg jq zlib1g-dev cmake cmake-doc extra-cmake-modules build-essential gcc binutils bash coreutils util-linux pciutils usbutils coreutils binutils findutils grep && \
         ln -sf /bin/bash /bin/sh && \
-        pip3 install 'yq==2.12.0' && \
         rm -rf /var/lib/apt/lists/*
 
 ADD *.sh /
 
 ENTRYPOINT ["bash","/entrypoint.sh"]
-CMD ["all"]
+CMD ["--no-build"]
diff --git a/repo/entrypoint.sh b/repo/entrypoint.sh
index dfe0889..5b7c20e 100755
--- a/repo/entrypoint.sh
+++ b/repo/entrypoint.sh
@@ -1,14 +1,38 @@
 cd /piston/packages
 
 SERVER=1
+BUILD=1
+
+echo "Running through arguments.."
 
 for pkg in "$@"
 do
-    [[ "$pkg" = "--no-server" ]] && SERVER=0 || make -j16 $pkg.pkg.tar.gz
+    if [[ "$pkg" = "--no-server" ]]; then
+        echo "Not starting index server after builds"
+        SERVER=0
+    elif [[ "$pkg" = "--no-build" ]]; then
+        echo "Building no more package"
+        BUILD=0
+    else
+        if [[ $BUILD -eq 1 ]]; then
+            echo "Building package $pkg"
+            make -j16 $pkg.pkg.tar.gz
+            echo "Done with package $pkg"
+        else
+            echo "Building was disabled, skipping $pkg"
+        fi
+    fi
 done
 
 cd /piston/repo
+echo "Creating index"
 ./mkindex.sh
+echo "Index created"
 
-[[ $SERVER -eq 1 ]] && python3 -m http.server
+if [[ $SERVER -eq 1 ]]; then
+    echo "Starting index server.."
+    python3 -m http.server
+else
+    echo "Skipping starting index server"
+fi
 exit 0
\ No newline at end of file

From 9a6616107ba63ee265e0d7e8815b383b2e163338 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 13:25:43 +1300
Subject: [PATCH 19/49] ci(package): start both containers in tests

---
 .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 0285713..450c49d 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -51,7 +51,7 @@ jobs:
 
       - name: Run tests
         run: |
-          docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' --name piston_fs_repo docker.pkg.github.com/engineer-man/piston/repo-builder $PACKAGES
+          docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' --name piston_fs_repo docker.pkg.github.com/engineer-man/piston/repo-builder $PACKAGES &
           docker run -v $(pwd)'/data:/piston' -v $(pwd)'/repo:/repo' --privileged --name piston_api docker.pkg.github.com/engineer-man/piston/api & 
           echo Waiting for API to start..
           while [[ "$(curl -s -w '%{http_code}' http://api:6969/runtimes)" != "200" ]]; do sleep 5; done

From 911de04d982961b271280107f51d3e5fab19beec Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 13:28:02 +1300
Subject: [PATCH 20/49] ci(package): name container correctly

---
 .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 450c49d..f295edc 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -52,7 +52,7 @@ jobs:
       - name: Run tests
         run: |
           docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' --name piston_fs_repo docker.pkg.github.com/engineer-man/piston/repo-builder $PACKAGES &
-          docker run -v $(pwd)'/data:/piston' -v $(pwd)'/repo:/repo' --privileged --name piston_api docker.pkg.github.com/engineer-man/piston/api & 
+          docker run -v $(pwd)'/data:/piston' -v $(pwd)'/repo:/repo' --privileged --name api docker.pkg.github.com/engineer-man/piston/api & 
           echo Waiting for API to start..
           while [[ "$(curl -s -w '%{http_code}' http://api:6969/runtimes)" != "200" ]]; do sleep 5; done
 

From 31b9e98b06ac89e8d39ea661c5768bd207e9b361 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 13:49:30 +1300
Subject: [PATCH 21/49] ci(package): remove privilege

---
 .github/workflows/package-pr.yaml | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/package-pr.yaml b/.github/workflows/package-pr.yaml
index f295edc..ccf06be 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -11,7 +11,7 @@ on:
       - 'packages/**'
 
 jobs:
-  check-build:
+  build-pkg:
     name: Check that package builds
     runs-on: ubuntu-latest
     steps:
@@ -29,6 +29,23 @@ jobs:
         run: |
           docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' docker.pkg.github.com/engineer-man/piston/repo-builder $(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | awk -F/ '{ print $2 "-" $3 }' | sort -u) --no-server
 
+      - name: Upload package as artifact
+        uses: actions/upload-artifact@v2
+        with:
+          name: packages
+          path: packages/*.pkg.tar.gz
+
+
+    test-pkg:
+      name: Test package
+      runs-on: ubuntu-latest
+      steps:
+      - uses: actions/checkout@v2
+
+      - uses: actions/download-artifact@v2
+        with:
+          name: packages
+
       - name: Write test config file
         uses: DamianReeves/write-file-action@v1.0
         with:
@@ -52,7 +69,7 @@ jobs:
       - name: Run tests
         run: |
           docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' --name piston_fs_repo docker.pkg.github.com/engineer-man/piston/repo-builder $PACKAGES &
-          docker run -v $(pwd)'/data:/piston' -v $(pwd)'/repo:/repo' --privileged --name api docker.pkg.github.com/engineer-man/piston/api & 
+          docker run -v $(pwd)'/data:/piston' --name api docker.pkg.github.com/engineer-man/piston/api & 
           echo Waiting for API to start..
           while [[ "$(curl -s -w '%{http_code}' http://api:6969/runtimes)" != "200" ]]; do sleep 5; done
 

From db605e70fb2fd274dd04d7386410a77f3f0b8fda Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 13:50:44 +1300
Subject: [PATCH 22/49] ci(package): indentation

---
 .github/workflows/package-pr.yaml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/package-pr.yaml b/.github/workflows/package-pr.yaml
index ccf06be..6d37f07 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -36,10 +36,10 @@ jobs:
           path: packages/*.pkg.tar.gz
 
 
-    test-pkg:
-      name: Test package
-      runs-on: ubuntu-latest
-      steps:
+  test-pkg:
+    name: Test package
+    runs-on: ubuntu-latest
+    steps:
       - uses: actions/checkout@v2
 
       - uses: actions/download-artifact@v2

From 7b57bef1677a54f45cf81bc845cfe9d31a0bae3b Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 13:52:20 +1300
Subject: [PATCH 23/49] ci(package): test depends on build

---
 .github/workflows/package-pr.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.github/workflows/package-pr.yaml b/.github/workflows/package-pr.yaml
index 6d37f07..fcc1cfb 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -39,6 +39,7 @@ jobs:
   test-pkg:
     name: Test package
     runs-on: ubuntu-latest
+    needs: build-pkg
     steps:
       - uses: actions/checkout@v2
 

From d529384f219c6e82e25903922eb623ae57a35417 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 13:57:14 +1300
Subject: [PATCH 24/49] api: quote args when being executed

---
 api/src/executor/job.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/api/src/executor/job.js b/api/src/executor/job.js
index ba739c4..9e48399 100644
--- a/api/src/executor/job.js
+++ b/api/src/executor/job.js
@@ -81,7 +81,7 @@ class Job {
             const proc_call = [
                 ...prlimit,
                 ...unshare,
-                'bash',file, ...args
+                'bash',file, ...args.map(x=>`"${x}"`)
             ];
 
             var stdout = '';

From be1b93cf1f2f1a735fe50fc91d7e1148b4f37f03 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 14:50:55 +1300
Subject: [PATCH 25/49] repo: add CI mode

---
 repo/Dockerfile    |  2 +-
 repo/README.MD     |  7 -------
 repo/entrypoint.sh | 11 +++++++++++
 3 files changed, 12 insertions(+), 8 deletions(-)
 delete mode 100644 repo/README.MD

diff --git a/repo/Dockerfile b/repo/Dockerfile
index a326146..231289a 100644
--- a/repo/Dockerfile
+++ b/repo/Dockerfile
@@ -4,7 +4,7 @@ RUN apt-get update && apt-get install -y unzip autoconf build-essential libssl-d
         ln -sf /bin/bash /bin/sh && \
         rm -rf /var/lib/apt/lists/*
 
-ADD *.sh /
+ADD entrypoint.sh mkindex.sh /
 
 ENTRYPOINT ["bash","/entrypoint.sh"]
 CMD ["--no-build"]
diff --git a/repo/README.MD b/repo/README.MD
deleted file mode 100644
index 28f833f..0000000
--- a/repo/README.MD
+++ /dev/null
@@ -1,7 +0,0 @@
-# Piston Filesystem Repo Builder
-
-This is just a simple POC for a repository tool to run locally.
-
-This only demonstrates building an unsigned python-3.9.1 package, however if it finds an `asc` file it will include it as the signature.
-
-Mount this whole directory into `/repo` in your API container if you wish to use it.
\ No newline at end of file
diff --git a/repo/entrypoint.sh b/repo/entrypoint.sh
index 5b7c20e..c5c075c 100755
--- a/repo/entrypoint.sh
+++ b/repo/entrypoint.sh
@@ -3,16 +3,27 @@ cd /piston/packages
 SERVER=1
 BUILD=1
 
+ls -la /piston /piston/*
+
 echo "Running through arguments.."
 
 for pkg in "$@"
 do
+    shift
     if [[ "$pkg" = "--no-server" ]]; then
         echo "Not starting index server after builds"
         SERVER=0
     elif [[ "$pkg" = "--no-build" ]]; then
         echo "Building no more package"
         BUILD=0
+    elif [[ "$pkg" = "--ci" ]]; then
+        echo "Running in CI mode, --no-build, --no-server"
+        BUILD=0
+        SERVER=0
+        for package in "$(git diff-tree --no-commit-id --name-only -r $1 | awk -F/ '{ print $2 "-" $3 }' | sort -u)"; do
+            make -j16 $package.pkg.tar.gz
+        done
+
     else
         if [[ $BUILD -eq 1 ]]; then
             echo "Building package $pkg"

From fd8b8515f45451bfe0cf917174d4d32820839356 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 14:51:29 +1300
Subject: [PATCH 26/49] ci(package): testing

---
 .github/workflows/package-pr.yaml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/package-pr.yaml b/.github/workflows/package-pr.yaml
index fcc1cfb..4389518 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -27,7 +27,8 @@ jobs:
           
       - name: Build Packages
         run: |
-          docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' docker.pkg.github.com/engineer-man/piston/repo-builder $(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | awk -F/ '{ print $2 "-" $3 }' | sort -u) --no-server
+          docker run -v "${{ github.workspace }}:/piston" piston_fs_repo --ci 05dc79d9f8884cdfe889536c95eec6a72e505706
+          ls -la /piston/*
 
       - name: Upload package as artifact
         uses: actions/upload-artifact@v2

From b029276a67bd4c5162e86a1e25779013bba64785 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 14:52:14 +1300
Subject: [PATCH 27/49] ci(package): use correct docker image

---
 .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 4389518..a835591 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -27,7 +27,7 @@ jobs:
           
       - name: Build Packages
         run: |
-          docker run -v "${{ github.workspace }}:/piston" piston_fs_repo --ci 05dc79d9f8884cdfe889536c95eec6a72e505706
+          docker run -v "${{ github.workspace }}:/piston" docker.pkg.github.com/engineer-man/piston/repo-builder:latest --ci 05dc79d9f8884cdfe889536c95eec6a72e505706
           ls -la /piston/*
 
       - name: Upload package as artifact

From 02986e6a41acf70b63c9bca7fbda73d4a1a9fc73 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 15:07:08 +1300
Subject: [PATCH 28/49] ci(package): pass in correct sha

---
 .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 a835591..4053d32 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -27,7 +27,7 @@ jobs:
           
       - name: Build Packages
         run: |
-          docker run -v "${{ github.workspace }}:/piston" docker.pkg.github.com/engineer-man/piston/repo-builder:latest --ci 05dc79d9f8884cdfe889536c95eec6a72e505706
+          docker run -v "${{ github.workspace }}:/piston" docker.pkg.github.com/engineer-man/piston/repo-builder:latest --ci ${{ github.sha }}
           ls -la /piston/*
 
       - name: Upload package as artifact

From 55f45e05bc3cfd1cb75a0fb3be0e1daab5da0038 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 15:10:08 +1300
Subject: [PATCH 29/49] ci(package): list out packages/repo

---
 .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 4053d32..a3bdefd 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -28,7 +28,7 @@ jobs:
       - name: Build Packages
         run: |
           docker run -v "${{ github.workspace }}:/piston" docker.pkg.github.com/engineer-man/piston/repo-builder:latest --ci ${{ github.sha }}
-          ls -la /piston/*
+          ls -la piston/{packages,repo}
 
       - name: Upload package as artifact
         uses: actions/upload-artifact@v2

From d0f89327229f6d896387f539ebdcaac3ad30a33c Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 15:11:33 +1300
Subject: [PATCH 30/49] pkg(all): replace $* with "$@"

---
 packages/bash/5.1.0/run           | 2 +-
 packages/dart/2.12.1/run          | 2 +-
 packages/deno/1.7.5/run           | 2 +-
 packages/gawk/5.1.0/run           | 2 +-
 packages/gcc/10.2.0/compile       | 8 ++++----
 packages/gcc/10.2.0/run           | 2 +-
 packages/java/15.0.2/run          | 2 +-
 packages/jelly/0.1.31/run         | 2 +-
 packages/kotlin/1.4.31/compile    | 2 +-
 packages/mono/6.12.0/compile      | 2 +-
 packages/mono/6.12.0/run          | 2 +-
 packages/nasm/2.15.5/compile      | 4 ++--
 packages/nasm/2.15.5/run          | 2 +-
 packages/node/15.10.0/run         | 2 +-
 packages/php/8.0.2/run            | 2 +-
 packages/python/3.9.1/run         | 2 +-
 packages/typescript/4.2.3/compile | 2 +-
 packages/typescript/4.2.3/run     | 2 +-
 18 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/packages/bash/5.1.0/run b/packages/bash/5.1.0/run
index be4ec50..a8f3ffb 100644
--- a/packages/bash/5.1.0/run
+++ b/packages/bash/5.1.0/run
@@ -1,4 +1,4 @@
 #!/usr/bin/env bash
 
 # Put instructions to run the runtime
-bash $*
+bash "$@"
diff --git a/packages/dart/2.12.1/run b/packages/dart/2.12.1/run
index dfdbd40..aae792a 100644
--- a/packages/dart/2.12.1/run
+++ b/packages/dart/2.12.1/run
@@ -1,4 +1,4 @@
 #!/usr/bin/env bash
 
 # Put instructions to run the runtime
-dart run $*
+dart run "$@"
diff --git a/packages/deno/1.7.5/run b/packages/deno/1.7.5/run
index 9bcf3ef..d1b196f 100644
--- a/packages/deno/1.7.5/run
+++ b/packages/deno/1.7.5/run
@@ -1,2 +1,2 @@
 #!/bin/bash
-DENO_DIR=$PWD deno run $*
\ No newline at end of file
+DENO_DIR=$PWD deno run "$@"
\ No newline at end of file
diff --git a/packages/gawk/5.1.0/run b/packages/gawk/5.1.0/run
index 567b400..5134ddf 100644
--- a/packages/gawk/5.1.0/run
+++ b/packages/gawk/5.1.0/run
@@ -1,4 +1,4 @@
 #!/usr/bin/env bash
 
 # Put instructions to run the runtime
-gawk-5.1.0 -f $*
+gawk-5.1.0 -f "$@"
diff --git a/packages/gcc/10.2.0/compile b/packages/gcc/10.2.0/compile
index e83346d..acc9ae4 100644
--- a/packages/gcc/10.2.0/compile
+++ b/packages/gcc/10.2.0/compile
@@ -5,16 +5,16 @@
 
 case "${PISTON_ALIAS}" in
     gcc | c)
-        gcc -std=c11 $* -lm
+        gcc -std=c11 "$@" -lm
         ;;
     g++ | c++ | cpp)
-        g++ -std=c++17 $*
+        g++ -std=c++17 "$@"
         ;;
     gccgo | go)
-        gccgo $*
+        gccgo "$@"
         ;;
     gdc | d)
-        gdc $*
+        gdc "$@"
         ;;
     *)
         echo "How did you get here? (${PISTON_ALIAS})"
diff --git a/packages/gcc/10.2.0/run b/packages/gcc/10.2.0/run
index 63e3443..60ad16b 100644
--- a/packages/gcc/10.2.0/run
+++ b/packages/gcc/10.2.0/run
@@ -3,4 +3,4 @@
 # Put instructions to run the runtime
 
 shift # Discard main filename
-./a.out $*
+./a.out "$@"
diff --git a/packages/java/15.0.2/run b/packages/java/15.0.2/run
index 2215edd..0837ba4 100644
--- a/packages/java/15.0.2/run
+++ b/packages/java/15.0.2/run
@@ -1,4 +1,4 @@
 #!/usr/bin/env bash
 
 # Put instructions to run the runtime
-java $*
+java "$@"
diff --git a/packages/jelly/0.1.31/run b/packages/jelly/0.1.31/run
index 7f4dd38..e07c1af 100644
--- a/packages/jelly/0.1.31/run
+++ b/packages/jelly/0.1.31/run
@@ -1 +1 @@
-jelly fu $*
\ No newline at end of file
+jelly fu "$@"
\ No newline at end of file
diff --git a/packages/kotlin/1.4.31/compile b/packages/kotlin/1.4.31/compile
index 8be38a7..d042c39 100644
--- a/packages/kotlin/1.4.31/compile
+++ b/packages/kotlin/1.4.31/compile
@@ -1,4 +1,4 @@
 #!/usr/bin/env bash
 
 # Put instructions to compile source code, remove this file if the language does not require this stage
-kotlinc $* -include-runtime -d code.jar
\ No newline at end of file
+kotlinc "$@" -include-runtime -d code.jar
\ No newline at end of file
diff --git a/packages/mono/6.12.0/compile b/packages/mono/6.12.0/compile
index 3151cde..746c05e 100644
--- a/packages/mono/6.12.0/compile
+++ b/packages/mono/6.12.0/compile
@@ -1,3 +1,3 @@
 #!/bin/bash
 
-csc $*
\ No newline at end of file
+csc "$@"
\ No newline at end of file
diff --git a/packages/mono/6.12.0/run b/packages/mono/6.12.0/run
index 9d9b61a..557ce76 100644
--- a/packages/mono/6.12.0/run
+++ b/packages/mono/6.12.0/run
@@ -2,4 +2,4 @@
 
 CODE=${1/cs/exe}
 shift
-mono $CODE $*
\ No newline at end of file
+mono $CODE "$@"
\ No newline at end of file
diff --git a/packages/nasm/2.15.5/compile b/packages/nasm/2.15.5/compile
index a8fe6da..e481319 100644
--- a/packages/nasm/2.15.5/compile
+++ b/packages/nasm/2.15.5/compile
@@ -5,11 +5,11 @@
 
 case "${PISTON_ALIAS}" in
     nasm)
-        nasm -f elf32 -o binary.o $*
+        nasm -f elf32 -o binary.o "$@"
         ld -m elf_i386 binary.o -o binary
         ;;
     nasm64)
-        nasm -f elf64 -o binary.o $*
+        nasm -f elf64 -o binary.o "$@"
         ld -m elf_x86_64 binary.o -o binary
         ;;
     *)
diff --git a/packages/nasm/2.15.5/run b/packages/nasm/2.15.5/run
index 53a6099..f910a1c 100644
--- a/packages/nasm/2.15.5/run
+++ b/packages/nasm/2.15.5/run
@@ -2,4 +2,4 @@
 
 # Put instructions to run the runtime
 shift
-./binary $*
+./binary "$@"
diff --git a/packages/node/15.10.0/run b/packages/node/15.10.0/run
index 004ca32..6d1fdee 100644
--- a/packages/node/15.10.0/run
+++ b/packages/node/15.10.0/run
@@ -1,3 +1,3 @@
 #!/bin/bash
 
-node $*
\ No newline at end of file
+node "$@"
\ No newline at end of file
diff --git a/packages/php/8.0.2/run b/packages/php/8.0.2/run
index 2bce27a..1261d95 100644
--- a/packages/php/8.0.2/run
+++ b/packages/php/8.0.2/run
@@ -1,3 +1,3 @@
 #!/bin/bash
 
-php $*
\ No newline at end of file
+php "$@"
\ No newline at end of file
diff --git a/packages/python/3.9.1/run b/packages/python/3.9.1/run
index 7b3205b..450bb76 100644
--- a/packages/python/3.9.1/run
+++ b/packages/python/3.9.1/run
@@ -1,3 +1,3 @@
 #!/bin/bash
 
-python3.9 $*
\ No newline at end of file
+python3.9 "$@"
\ No newline at end of file
diff --git a/packages/typescript/4.2.3/compile b/packages/typescript/4.2.3/compile
index 1258d16..fdf5f19 100644
--- a/packages/typescript/4.2.3/compile
+++ b/packages/typescript/4.2.3/compile
@@ -2,4 +2,4 @@
 
 # Put instructions to compile source code, remove this file if the language does not require this stage
 
-tsc $*
\ No newline at end of file
+tsc "$@"
\ No newline at end of file
diff --git a/packages/typescript/4.2.3/run b/packages/typescript/4.2.3/run
index dfd4249..1d26f3f 100644
--- a/packages/typescript/4.2.3/run
+++ b/packages/typescript/4.2.3/run
@@ -5,4 +5,4 @@
 CODE=$(sed 's/ts$/js/' <<<"$1")
 shift
 
-node $CODE $*
+node $CODE "$@"

From fda944359a5ed6d58bc08d792d95d90b68225529 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 15:12:20 +1300
Subject: [PATCH 31/49] ci(package): current dir...

---
 .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 a3bdefd..39d18ab 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -28,7 +28,7 @@ jobs:
       - name: Build Packages
         run: |
           docker run -v "${{ github.workspace }}:/piston" docker.pkg.github.com/engineer-man/piston/repo-builder:latest --ci ${{ github.sha }}
-          ls -la piston/{packages,repo}
+          ls -la packages repo
 
       - name: Upload package as artifact
         uses: actions/upload-artifact@v2

From 5c5940009317b6774a53d563c4f8978d80ce7d0e Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 15:17:48 +1300
Subject: [PATCH 32/49] repo: more verbosity

---
 repo/entrypoint.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/repo/entrypoint.sh b/repo/entrypoint.sh
index c5c075c..5c2964d 100755
--- a/repo/entrypoint.sh
+++ b/repo/entrypoint.sh
@@ -20,7 +20,9 @@ do
         echo "Running in CI mode, --no-build, --no-server"
         BUILD=0
         SERVER=0
-        for package in "$(git diff-tree --no-commit-id --name-only -r $1 | awk -F/ '{ print $2 "-" $3 }' | sort -u)"; do
+        PACKAGES=$(git diff-tree --no-commit-id --name-only -r $1 | awk -F/ '{ print $2 "-" $3 }' | sort -u)
+        echo "Building packages: $PACKAGES"
+        for package in "$PACKAGES"; do
             make -j16 $package.pkg.tar.gz
         done
 

From d9cacd26771ddded49062011ee7c4741be79041b Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 15:23:36 +1300
Subject: [PATCH 33/49] repo: use correct commit sha

---
 repo/entrypoint.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/repo/entrypoint.sh b/repo/entrypoint.sh
index 5c2964d..40822ed 100755
--- a/repo/entrypoint.sh
+++ b/repo/entrypoint.sh
@@ -20,7 +20,9 @@ do
         echo "Running in CI mode, --no-build, --no-server"
         BUILD=0
         SERVER=0
-        PACKAGES=$(git diff-tree --no-commit-id --name-only -r $1 | awk -F/ '{ print $2 "-" $3 }' | sort -u)
+        SHA=$2
+        echo "Commit Sha: $SHA"
+        PACKAGES=$(git diff-tree --no-commit-id --name-only -r $SHA | awk -F/ '{ print $2 "-" $3 }' | sort -u)
         echo "Building packages: $PACKAGES"
         for package in "$PACKAGES"; do
             make -j16 $package.pkg.tar.gz

From 46ae4a9487cf3108b993bbb1e43ccab1a9c070db Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 15:28:45 +1300
Subject: [PATCH 34/49] repo: correct commit sha...

---
 repo/entrypoint.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/repo/entrypoint.sh b/repo/entrypoint.sh
index 40822ed..cede653 100755
--- a/repo/entrypoint.sh
+++ b/repo/entrypoint.sh
@@ -20,7 +20,8 @@ do
         echo "Running in CI mode, --no-build, --no-server"
         BUILD=0
         SERVER=0
-        SHA=$2
+        SHA=$1
+        shift
         echo "Commit Sha: $SHA"
         PACKAGES=$(git diff-tree --no-commit-id --name-only -r $SHA | awk -F/ '{ print $2 "-" $3 }' | sort -u)
         echo "Building packages: $PACKAGES"

From 7fa1a4b5e08a8f4f477827485243d202eb98f650 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 15:29:44 +1300
Subject: [PATCH 35/49] ci(api): pull existing container

---
 .github/workflows/api-push.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.github/workflows/api-push.yaml b/.github/workflows/api-push.yaml
index 351a69e..ecf7a29 100644
--- a/.github/workflows/api-push.yaml
+++ b/.github/workflows/api-push.yaml
@@ -21,6 +21,8 @@ jobs:
           username: ${{ github.actor }}
           password: ${{ secrets.GITHUB_TOKEN }}
           registry: docker.pkg.github.com
+      - name: Pull existing
+        run: docker pull docker.pkg.github.com/engineer-man/piston/api
 
       - name: Build and push API
         uses: docker/build-push-action@v2

From bb8b0dbd91bb9c1ca42483d85e7aff54b263a3c1 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 15:29:50 +1300
Subject: [PATCH 36/49] ci(repo): pull existing container

---
 .github/workflows/repo-push.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.github/workflows/repo-push.yaml b/.github/workflows/repo-push.yaml
index 5516c47..649b1cd 100644
--- a/.github/workflows/repo-push.yaml
+++ b/.github/workflows/repo-push.yaml
@@ -20,6 +20,8 @@ jobs:
           username: ${{ github.actor }}
           password: ${{ secrets.GITHUB_TOKEN }}
           registry: docker.pkg.github.com
+      - name: Pull existing
+        run: docker pull docker.pkg.github.com/engineer-man/piston/repo-builder
 
       - name: Build and push repo
         uses: docker/build-push-action@v2

From b36cb64105631dcd844bfbc370a7330e75c72090 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 15:33:29 +1300
Subject: [PATCH 37/49] api: revert quoting of args

---
 api/src/executor/job.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/api/src/executor/job.js b/api/src/executor/job.js
index 9e48399..445c73a 100644
--- a/api/src/executor/job.js
+++ b/api/src/executor/job.js
@@ -81,7 +81,8 @@ class Job {
             const proc_call = [
                 ...prlimit,
                 ...unshare,
-                'bash',file, ...args.map(x=>`"${x}"`)
+                'bash',file,
+                ...args
             ];
 
             var stdout = '';

From ca3a4c3c0b98f87065e64cd47fa1c7cd0235d7aa Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 15:43:24 +1300
Subject: [PATCH 38/49] ci(package): get all commits

---
 .github/workflows/package-pr.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/package-pr.yaml b/.github/workflows/package-pr.yaml
index 39d18ab..6fdb1d7 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -27,7 +27,9 @@ jobs:
           
       - name: Build Packages
         run: |
-          docker run -v "${{ github.workspace }}:/piston" docker.pkg.github.com/engineer-man/piston/repo-builder:latest --ci ${{ github.sha }}
+          SHALIST=$(curl "https://api.github.com/repos/$GITHUB_REPOSITORY/pulls/$(jq -r '.pull_request.number' $GITHUB_EVENT_PATH)"/commits | jq '.[].sha' -r)
+          echo "Commits: $SHALIST"
+          docker run -v "${{ github.workspace }}:/piston" docker.pkg.github.com/engineer-man/piston/repo-builder:latest --ci $SHALIST
           ls -la packages repo
 
       - name: Upload package as artifact

From 14f582eb33b6b51bf542e20c5a76d1a62248a186 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 15:47:11 +1300
Subject: [PATCH 39/49] ci(package): use commit sha

---
 .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 6fdb1d7..bc36b38 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -27,7 +27,7 @@ jobs:
           
       - name: Build Packages
         run: |
-          SHALIST=$(curl "https://api.github.com/repos/$GITHUB_REPOSITORY/pulls/$(jq -r '.pull_request.number' $GITHUB_EVENT_PATH)"/commits | jq '.[].sha' -r)
+          SHALIST=$(curl "https://api.github.com/repos/$GITHUB_REPOSITORY/pulls/$(jq -r '.pull_request.number' $GITHUB_EVENT_PATH)"/commits | jq '.[].commit.tree.sha' -r)
           echo "Commits: $SHALIST"
           docker run -v "${{ github.workspace }}:/piston" docker.pkg.github.com/engineer-man/piston/repo-builder:latest --ci $SHALIST
           ls -la packages repo

From d10496cc7898d5e421ece98e328e39060dd2b1a6 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 15:49:59 +1300
Subject: [PATCH 40/49] ci(package): add git log??

---
 .github/workflows/package-pr.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.github/workflows/package-pr.yaml b/.github/workflows/package-pr.yaml
index bc36b38..b451a6b 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -29,6 +29,7 @@ jobs:
         run: |
           SHALIST=$(curl "https://api.github.com/repos/$GITHUB_REPOSITORY/pulls/$(jq -r '.pull_request.number' $GITHUB_EVENT_PATH)"/commits | jq '.[].commit.tree.sha' -r)
           echo "Commits: $SHALIST"
+          git log
           docker run -v "${{ github.workspace }}:/piston" docker.pkg.github.com/engineer-man/piston/repo-builder:latest --ci $SHALIST
           ls -la packages repo
 

From 4626176222d2addf93c8e4f177ba8c5bfefa6e64 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 15:56:17 +1300
Subject: [PATCH 41/49] ci(package): use head commit

---
 .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 b451a6b..94a2475 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -27,7 +27,7 @@ jobs:
           
       - name: Build Packages
         run: |
-          SHALIST=$(curl "https://api.github.com/repos/$GITHUB_REPOSITORY/pulls/$(jq -r '.pull_request.number' $GITHUB_EVENT_PATH)"/commits | jq '.[].commit.tree.sha' -r)
+          SHALIST=$(git rev-parse HEAD)
           echo "Commits: $SHALIST"
           git log
           docker run -v "${{ github.workspace }}:/piston" docker.pkg.github.com/engineer-man/piston/repo-builder:latest --ci $SHALIST

From 84757560fc377a9aaa6978b448d2c3667ce1160a Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 16:03:40 +1300
Subject: [PATCH 42/49] repo: verbosity

---
 repo/entrypoint.sh | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/repo/entrypoint.sh b/repo/entrypoint.sh
index cede653..429ead9 100755
--- a/repo/entrypoint.sh
+++ b/repo/entrypoint.sh
@@ -2,8 +2,7 @@ cd /piston/packages
 
 SERVER=1
 BUILD=1
-
-ls -la /piston /piston/*
+CI=0
 
 echo "Running through arguments.."
 
@@ -20,22 +19,26 @@ do
         echo "Running in CI mode, --no-build, --no-server"
         BUILD=0
         SERVER=0
-        SHA=$1
-        shift
-        echo "Commit Sha: $SHA"
-        PACKAGES=$(git diff-tree --no-commit-id --name-only -r $SHA | awk -F/ '{ print $2 "-" $3 }' | sort -u)
-        echo "Building packages: $PACKAGES"
-        for package in "$PACKAGES"; do
-            make -j16 $package.pkg.tar.gz
-        done
-
+        CI=1
     else
         if [[ $BUILD -eq 1 ]]; then
             echo "Building package $pkg"
             make -j16 $pkg.pkg.tar.gz
             echo "Done with package $pkg"
+        elif [[ $CI -eq 1 ]]; then
+            echo "Commit SHA: $pkg"
+            
+            echo "Changed files:"
+            git diff-tree --no-commit-id --name-only -r $pkg
+            
+            PACKAGES=$(git diff-tree --no-commit-id --name-only -r $pkg | awk -F/ '{ print $2 "-" $3 }' | sort -u)
+            echo "Building packages: $PACKAGES"
+            for package in "$PACKAGES"; do
+                make -j16 $package.pkg.tar.gz
+            done
+
         else
-            echo "Building was disabled, skipping $pkg"
+            echo "Building was disabled, skipping $pkg build=$BUILD ci=$CI"
         fi
     fi
 done

From 0ae6ee16325c7ba7c608ece54829539000ce49b3 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 16:05:11 +1300
Subject: [PATCH 43/49] ci(repo): pull using action

---
 .github/workflows/repo-push.yaml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/.github/workflows/repo-push.yaml b/.github/workflows/repo-push.yaml
index 649b1cd..b5a603c 100644
--- a/.github/workflows/repo-push.yaml
+++ b/.github/workflows/repo-push.yaml
@@ -20,13 +20,12 @@ jobs:
           username: ${{ github.actor }}
           password: ${{ secrets.GITHUB_TOKEN }}
           registry: docker.pkg.github.com
-      - name: Pull existing
-        run: docker pull docker.pkg.github.com/engineer-man/piston/repo-builder
 
       - name: Build and push repo
         uses: docker/build-push-action@v2
         with:
           context: repo
+          pull: true
           push: true
           tags: |
             docker.pkg.github.com/engineer-man/piston/repo-builder
\ No newline at end of file

From f1a74a0d686b62bffc1679fc3f337354b1e7d53c Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 16:06:42 +1300
Subject: [PATCH 44/49] ci(api): pull using action

---
 .github/workflows/api-push.yaml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/.github/workflows/api-push.yaml b/.github/workflows/api-push.yaml
index ecf7a29..7bafdc1 100644
--- a/.github/workflows/api-push.yaml
+++ b/.github/workflows/api-push.yaml
@@ -21,13 +21,12 @@ jobs:
           username: ${{ github.actor }}
           password: ${{ secrets.GITHUB_TOKEN }}
           registry: docker.pkg.github.com
-      - name: Pull existing
-        run: docker pull docker.pkg.github.com/engineer-man/piston/api
 
       - name: Build and push API
         uses: docker/build-push-action@v2
         with:
           context: api
           push: true
+          pull: true
           tags: |
             docker.pkg.github.com/engineer-man/piston/api
\ No newline at end of file

From 00dd38b83d59837e43524992d7949e298ca0cc2d Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 16:12:28 +1300
Subject: [PATCH 45/49] repo: get changed files

---
 repo/entrypoint.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/repo/entrypoint.sh b/repo/entrypoint.sh
index 429ead9..d9fc973 100755
--- a/repo/entrypoint.sh
+++ b/repo/entrypoint.sh
@@ -29,9 +29,9 @@ do
             echo "Commit SHA: $pkg"
             
             echo "Changed files:"
-            git diff-tree --no-commit-id --name-only -r $pkg
+            git diff --name-only $pkg^1 $pkg
             
-            PACKAGES=$(git diff-tree --no-commit-id --name-only -r $pkg | awk -F/ '{ print $2 "-" $3 }' | sort -u)
+            PACKAGES=$(git diff --name-only $pkg^1 $pkg | awk -F/ '{ print $2 "-" $3 }' | sort -u)
             echo "Building packages: $PACKAGES"
             for package in "$PACKAGES"; do
                 make -j16 $package.pkg.tar.gz

From baf00ada3d357de90836b137900798381c9e4c51 Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 16:21:01 +1300
Subject: [PATCH 46/49] ci(package): point to head

---
 .github/workflows/package-pr.yaml | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/.github/workflows/package-pr.yaml b/.github/workflows/package-pr.yaml
index 94a2475..5bf3834 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -27,10 +27,7 @@ jobs:
           
       - name: Build Packages
         run: |
-          SHALIST=$(git rev-parse HEAD)
-          echo "Commits: $SHALIST"
-          git log
-          docker run -v "${{ github.workspace }}:/piston" docker.pkg.github.com/engineer-man/piston/repo-builder:latest --ci $SHALIST
+          docker run -v "${{ github.workspace }}:/piston" docker.pkg.github.com/engineer-man/piston/repo-builder:latest --ci HEAD
           ls -la packages repo
 
       - name: Upload package as artifact

From 7bca798c0bf65d079984d7e19d8950872bc99bad Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 16:38:48 +1300
Subject: [PATCH 47/49] ci(package): test

---
 .github/workflows/package-pr.yaml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/package-pr.yaml b/.github/workflows/package-pr.yaml
index 5bf3834..e6dcbcf 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -27,8 +27,9 @@ jobs:
           
       - name: Build Packages
         run: |
-          docker run -v "${{ github.workspace }}:/piston" docker.pkg.github.com/engineer-man/piston/repo-builder:latest --ci HEAD
-          ls -la packages repo
+          git diff --name-only HEAD^1 HEAD
+          echo docker run -v "${{ github.workspace }}:/piston" docker.pkg.github.com/engineer-man/piston/repo-builder:latest --no-server
+          ls -la packages
 
       - name: Upload package as artifact
         uses: actions/upload-artifact@v2

From 2c1ca22cdd05289ad8fce717058fad165a8fa4cb Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 16:41:52 +1300
Subject: [PATCH 48/49] ci(package): test

---
 .github/workflows/package-pr.yaml | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/package-pr.yaml b/.github/workflows/package-pr.yaml
index e6dcbcf..4d9454d 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -24,10 +24,15 @@ jobs:
           username: ${{ github.actor }}
           password: ${{ secrets.GITHUB_TOKEN }}
           registry: docker.pkg.github.com
-          
+
+      - name: Get list of changed files
+        uses: lots0logs/gh-action-get-changed-files@2.1.4
+        with:
+          token: ${{ secrets.GITHUB_TOKEN }}
+                
       - name: Build Packages
         run: |
-          git diff --name-only HEAD^1 HEAD
+          cat ${HOME}/files.json
           echo docker run -v "${{ github.workspace }}:/piston" docker.pkg.github.com/engineer-man/piston/repo-builder:latest --no-server
           ls -la packages
 

From abec6cf2444e354d4df90c5570162481c3f6cecd Mon Sep 17 00:00:00 2001
From: Thomas Hobson <git@hexf.me>
Date: Sun, 14 Mar 2021 16:43:50 +1300
Subject: [PATCH 49/49] ci(package): get list of packages from pr

---
 .github/workflows/package-pr.yaml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/package-pr.yaml b/.github/workflows/package-pr.yaml
index 4d9454d..cc5e46e 100644
--- a/.github/workflows/package-pr.yaml
+++ b/.github/workflows/package-pr.yaml
@@ -32,8 +32,9 @@ jobs:
                 
       - name: Build Packages
         run: |
-          cat ${HOME}/files.json
-          echo docker run -v "${{ github.workspace }}:/piston" docker.pkg.github.com/engineer-man/piston/repo-builder:latest --no-server
+          PACKAGES=$(jq '.[]' -r ${HOME}/files.json | awk -F/ '{ print $2 "-" $3 }' | sort -u)
+          echo "Packages: $PACKAGES"
+          docker run -v "${{ github.workspace }}:/piston" docker.pkg.github.com/engineer-man/piston/repo-builder:latest --no-server $PACKAGES
           ls -la packages
 
       - name: Upload package as artifact