Skip to content

Commit

Permalink
fix: pass github token to benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
Pacman99 authored and zeme-wana committed Nov 29, 2022
1 parent db9f6a0 commit 1d961f0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
10 changes: 8 additions & 2 deletions nix/cells/cloud/library/plutus-benchmark-runner.nix
@@ -1,6 +1,6 @@
{ cell, inputs }:

{ PR_NUMBER, PR_COMMIT_SHA, BENCHMARK_NAME }:
{ PR_NUMBER, PR_COMMIT_SHA, BENCHMARK_NAME, GITHUB_TOKEN }:

let
inherit (inputs.cells.plutus.library) pkgs;
Expand All @@ -9,5 +9,11 @@ in
pkgs.writeShellApplication {
name = "plutus-benchmark-runner";
runtimeInputs = [ pkgs.nix pkgs.git pkgs.jq pkgs.curl ];
text = "${./plutus-benchmark-runner.sh} ${PR_NUMBER} ${PR_COMMIT_SHA} ${BENCHMARK_NAME}";
text = ''
PR_NUMBER=${PR_NUMBER} \
PR_COMMIT_SHA=${PR_COMMIT_SHA} \
BENCHMARK_NAME=${BENCHMARK_NAME} \
GITHUB_TOKEN=${GITHUB_TOKEN} \
${./plutus-benchmark-runner.sh}
'';
}
8 changes: 4 additions & 4 deletions nix/cells/cloud/library/plutus-benchmark-runner.sh
Expand Up @@ -22,10 +22,6 @@

set -e

PR_NUMBER=$1
PR_COMMIT_SHA=$2
BENCHMARK_NAME=$3

if [ -z "$PR_NUMBER" ] ; then
echo "[ci-plutus-benchmark]: 'PR_NUMBER' is not set! Exiting"
exit 1
Expand All @@ -38,6 +34,10 @@ if [ -z "$BENCHMARK_NAME" ] ; then
echo "[ci-plutus-benchmark]: 'BENCHMARK_NAME' is not set! Exiting"
exit 1
fi
if [ -z "$GITHUB_TOKEN" ] ; then
echo "[ci-plutus-benchmark]: 'GITHUB_TOKEN' is not set! Exiting"
exit 1
fi

PR_BRANCH_REF=$(git rev-parse --short $PR_COMMIT_SHA)

Expand Down
8 changes: 8 additions & 0 deletions nix/cells/cloud/pipelines.nix
Expand Up @@ -64,11 +64,19 @@ let
BENCHMARK_NAME = lib.removePrefix
"/benchmark"
config.actionRun.facts.github_comment.github_body.comment.body;
GITHUB_TOKEN = "/secrets/cicero/github/token";
};
in
{
preset.nix.enable = true;
command.text = "${runner}/bin/plutus-benchmark-runner";
nomad.templates = [
{
destination = "/secrets/cicero/github/token";
data = ''{{with secret "kv/data/cicero/github"}}{{.Data.data.token}}{{end}}'';
}
];

};

in
Expand Down

0 comments on commit 1d961f0

Please sign in to comment.