From 84a94c51e1ae6f5a4957db4b06f619156e5309eb Mon Sep 17 00:00:00 2001 From: frcroth Date: Wed, 28 Feb 2024 14:04:35 +0100 Subject: [PATCH 01/14] Update config.yml --- .circleci/config.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 749f2360c6b..eab6de8eb56 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -240,6 +240,10 @@ jobs: - run: name: Report coverage command: .circleci/not-on-master.sh docker-compose run base yarn coverage || true + - run: + name: Install dev deployment + command: | + .circleci/not-on-master.sh curl -X POST -H "X-Auth-Token: $RELEASE_API_TOKEN" "https://kubernetix.scm.io/hooks/install/webknossos/dev/${CIRCLE_BRANCH}?user=CI+%28nightly%29" - run: name: Send Slack notification (master only) command: .circleci/slack-notification.sh From 0a07c7c26aabacfd2dfc2d5e9d9b13c4199b323a Mon Sep 17 00:00:00 2001 From: frcroth Date: Wed, 28 Feb 2024 14:24:58 +0100 Subject: [PATCH 02/14] Another commit From ca0e2172c06c72519d56291f914b7da61787541c Mon Sep 17 00:00:00 2001 From: frcroth Date: Wed, 28 Feb 2024 15:26:05 +0100 Subject: [PATCH 03/14] Check draft status --- .circleci/config.yml | 178 +++---------------------------------------- 1 file changed, 11 insertions(+), 167 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index eab6de8eb56..b6b0a3b0c90 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -29,89 +29,6 @@ jobs: command: | docker pull scalableminds/webknossos-dev:$NORMALIZED_BRANCH || true DEV_CACHE=$NORMALIZED_BRANCH docker-compose build base - - run: - name: Prepare dependency folders - command: mkdir -p project/target target ~/.ivy2 ~/.cache/coursier ~/.cache/yarn - - restore_cache: - name: Restore target cache - keys: - - target-cache-{{ checksum ".circleci/cache_version" }}-{{ .Branch }} - - target-cache-{{ checksum ".circleci/cache_version" }}-master - - restore_cache: - name: Restore sbt cache - keys: - - sbt-cache-{{ checksum ".circleci/cache_version" }}-{{ checksum "project/Dependencies.scala" }} - - sbt-cache-{{ checksum ".circleci/cache_version" }}- - - restore_cache: - name: Restore yarn cache - keys: - - yarn-cache-{{ checksum ".circleci/cache_version" }}-{{ checksum "yarn.lock" }} - - yarn-cache-{{ checksum ".circleci/cache_version" }}- - - run: - name: Install frontend dependencies - command: docker-compose run -e PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true base yarn install --frozen-lockfile - - run: - name: Assert unique evolution numbers - command: docker-compose run base tools/postgres/dbtool.js assert-unique-evolution-numbers - - restore_cache: - name: Restore webpack cache - keys: - - webpack-cache-{{ checksum ".circleci/cache_version" }}-{{ .Branch }} - - webpack-cache-{{ checksum ".circleci/cache_version" }}-master - - run: - name: Assert schema.sql and evolutions are equal - command: | - docker-compose up -d postgres - sleep 3 - docker-compose run compile tools/postgres/dbtool.js check-evolutions-schema - - run: - name: Build frontend documentation - command: docker-compose run base yarn run docs - - run: - name: Build webknossos (webpack) - command: | - docker-compose run base yarn build - - run: - name: Build webknossos (sbt) - command: | - if [ "${CIRCLE_BRANCH}" == "master" ]; then - docker-compose run compile sbt -no-colors clean compile stage - else - docker-compose run compile sbt -no-colors -DfailOnWarning compile stage - fi - - run: - name: Build webknossos-datastore (sbt) - command: docker-compose run base sbt -no-colors -DfailOnWarning "project webknossosDatastore" copyMessages compile stage - - - run: - name: Build webknossos-tracingstore (sbt) - command: docker-compose run base sbt -no-colors -DfailOnWarning "project webknossosTracingstore" copyMessages compile stage - - - save_cache: - name: Save target cache - key: target-cache-{{ checksum ".circleci/cache_version" }}-{{ .Branch }}-{{ .Revision }} - paths: - - "project/target" - - "target" - - - save_cache: - name: Save sbt cache - key: sbt-cache-{{ checksum ".circleci/cache_version" }}-{{ checksum "project/Dependencies.scala" }} - paths: - - "~/.ivy2" - - "~/.cache/coursier" - - - save_cache: - name: Save yarn cache - key: yarn-cache-{{ checksum ".circleci/cache_version" }}-{{ checksum "yarn.lock" }} - paths: - - "~/.cache/yarn" - - - save_cache: - name: Save webpack cache - key: webpack-cache-{{ checksum ".circleci/cache_version" }}-{{ .Branch }}-{{ .Revision }} - paths: - - "node_modules/.cache/webpack" - run: name: Build webknossos docker image @@ -124,86 +41,6 @@ jobs: - run: name: Build webknossos-tracingstore docker image command: docker-compose build --pull webknossos-tracingstore - - - run: - name: Lint frontend code (rome and eslint) and check formatting - command: | - .circleci/not-on-master.sh docker-compose run base bash -c "yarn run lint && yarn run am-i-pretty" - - run: - name: Check for cyclic dependencies in front-end - command: | - .circleci/not-on-master.sh docker-compose run base yarn check-cyclic-dependencies - - run: - name: Run frontend tests - command: | - .circleci/not-on-master.sh docker-compose run base yarn test-verbose - - run: - name: Lint backend code and check formatting - command: | - .circleci/not-on-master.sh docker-compose run backend-lint-format - - run: - name: Run backend tests - command: | - .circleci/not-on-master.sh docker-compose run backend-tests - - run: - name: Run end-to-end tests - command: | - for i in {1..3}; do # retry - .circleci/not-on-master.sh docker-compose run e2e-tests && s=0 && break || s=$? - done - (exit $s) - - run: - name: Validate frontend types - command: | - .circleci/not-on-master.sh docker-compose run base yarn typecheck - - run: - name: Start webknossos - background: true - command: docker-compose up webknossos - - run: - name: Run webknossos smoke test - command: | - for i in {1..10}; do # retry - sleep 10 - curl --fail -v http://localhost:9000/api/health && s=0 && break || s=$? - done - (exit $s) - - run: - name: Stop webknossos - command: docker-compose down --volumes --remove-orphans - - - run: - name: Start webknossos-datastore - background: true - command: docker-compose up webknossos-datastore - - run: - name: Run webknossos-datastore smoke test - command: | - for i in {1..10}; do # retry - sleep 10 - curl --fail -v http://localhost:9090/data/health && s=0 && break || s=$? - done - (exit $s) - - run: - name: Stop webknossos-datastore - command: docker-compose down --volumes --remove-orphans - - - run: - name: Start webknossos-tracingstore - background: true - command: docker-compose up webknossos-tracingstore - - run: - name: Run webknossos-tracingstore smoke test - command: | - for i in {1..10}; do # retry - sleep 10 - curl --fail -v http://localhost:9050/tracings/health && s=0 && break || s=$? - done - (exit $s) - - run: - name: Stop webknossos-tracingstore - command: docker-compose down --volumes --remove-orphans - - run: name: Push docker images command: | @@ -237,13 +74,20 @@ jobs: retry docker push scalableminds/webknossos-dev:${NORMALIZED_BRANCH} fi docker logout - - run: - name: Report coverage - command: .circleci/not-on-master.sh docker-compose run base yarn coverage || true - run: name: Install dev deployment command: | - .circleci/not-on-master.sh curl -X POST -H "X-Auth-Token: $RELEASE_API_TOKEN" "https://kubernetix.scm.io/hooks/install/webknossos/dev/${CIRCLE_BRANCH}?user=CI+%28nightly%29" + if [ "${CIRCLE_BRANCH}" == "master" ]; then + PR_URL="$CIRCLE_PULL_REQUEST" + PR_NUMBER=$(echo $PR_URL | awk -F'/' '{print $NF}') + IS_DRAFT=curl "https://api.github.com/repos/scalableminds/webknossos/pulls/$PR_NUMBER" | jq '.draft' + if [ "$IS_DRAFT" == "true" ]; then + echo "PR is a draft, not installing dev deployment" + else + curl -X POST -H "X-Auth-Token: $RELEASE_API_TOKEN" "https://kubernetix.scm.io/hooks/install/webknossos/dev/${CIRCLE_BRANCH}?user=CI+%28nightly%29" + echo "Installed to $NORMALIZED:BRANCH.webknossos.xyz" + fi + fi - run: name: Send Slack notification (master only) command: .circleci/slack-notification.sh From d9d31791140742ad568bbcf3f0d7192c8b97362a Mon Sep 17 00:00:00 2001 From: frcroth Date: Wed, 28 Feb 2024 15:34:28 +0100 Subject: [PATCH 04/14] Restore some building --- .circleci/config.yml | 82 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index b6b0a3b0c90..9577ad1a975 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -29,7 +29,89 @@ jobs: command: | docker pull scalableminds/webknossos-dev:$NORMALIZED_BRANCH || true DEV_CACHE=$NORMALIZED_BRANCH docker-compose build base + - run: + name: Prepare dependency folders + command: mkdir -p project/target target ~/.ivy2 ~/.cache/coursier ~/.cache/yarn + - restore_cache: + name: Restore target cache + keys: + - target-cache-{{ checksum ".circleci/cache_version" }}-{{ .Branch }} + - target-cache-{{ checksum ".circleci/cache_version" }}-master + - restore_cache: + name: Restore sbt cache + keys: + - sbt-cache-{{ checksum ".circleci/cache_version" }}-{{ checksum "project/Dependencies.scala" }} + - sbt-cache-{{ checksum ".circleci/cache_version" }}- + - restore_cache: + name: Restore yarn cache + keys: + - yarn-cache-{{ checksum ".circleci/cache_version" }}-{{ checksum "yarn.lock" }} + - yarn-cache-{{ checksum ".circleci/cache_version" }}- + - run: + name: Install frontend dependencies + command: docker-compose run -e PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true base yarn install --frozen-lockfile + - run: + name: Assert unique evolution numbers + command: docker-compose run base tools/postgres/dbtool.js assert-unique-evolution-numbers + - restore_cache: + name: Restore webpack cache + keys: + - webpack-cache-{{ checksum ".circleci/cache_version" }}-{{ .Branch }} + - webpack-cache-{{ checksum ".circleci/cache_version" }}-master + - run: + name: Assert schema.sql and evolutions are equal + command: | + docker-compose up -d postgres + sleep 3 + docker-compose run compile tools/postgres/dbtool.js check-evolutions-schema + - run: + name: Build frontend documentation + command: docker-compose run base yarn run docs + - run: + name: Build webknossos (webpack) + command: | + docker-compose run base yarn build + - run: + name: Build webknossos (sbt) + command: | + if [ "${CIRCLE_BRANCH}" == "master" ]; then + docker-compose run compile sbt -no-colors clean compile stage + else + docker-compose run compile sbt -no-colors -DfailOnWarning compile stage + fi + - run: + name: Build webknossos-datastore (sbt) + command: docker-compose run base sbt -no-colors -DfailOnWarning "project webknossosDatastore" copyMessages compile stage + + - run: + name: Build webknossos-tracingstore (sbt) + command: docker-compose run base sbt -no-colors -DfailOnWarning "project webknossosTracingstore" copyMessages compile stage + + - save_cache: + name: Save target cache + key: target-cache-{{ checksum ".circleci/cache_version" }}-{{ .Branch }}-{{ .Revision }} + paths: + - "project/target" + - "target" + + - save_cache: + name: Save sbt cache + key: sbt-cache-{{ checksum ".circleci/cache_version" }}-{{ checksum "project/Dependencies.scala" }} + paths: + - "~/.ivy2" + - "~/.cache/coursier" + + - save_cache: + name: Save yarn cache + key: yarn-cache-{{ checksum ".circleci/cache_version" }}-{{ checksum "yarn.lock" }} + paths: + - "~/.cache/yarn" + - save_cache: + name: Save webpack cache + key: webpack-cache-{{ checksum ".circleci/cache_version" }}-{{ .Branch }}-{{ .Revision }} + paths: + - "node_modules/.cache/webpack" - run: name: Build webknossos docker image command: docker-compose build --pull webknossos From d26aa146a5b63a45f7349f45aeeee63e6faf1579 Mon Sep 17 00:00:00 2001 From: frcroth Date: Wed, 28 Feb 2024 15:45:24 +0100 Subject: [PATCH 05/14] Fix master check --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9577ad1a975..6b5f15e2669 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -159,7 +159,7 @@ jobs: - run: name: Install dev deployment command: | - if [ "${CIRCLE_BRANCH}" == "master" ]; then + if [ "${CIRCLE_BRANCH}" != "master" ]; then PR_URL="$CIRCLE_PULL_REQUEST" PR_NUMBER=$(echo $PR_URL | awk -F'/' '{print $NF}') IS_DRAFT=curl "https://api.github.com/repos/scalableminds/webknossos/pulls/$PR_NUMBER" | jq '.draft' From d0db00c194fb45473618bcc5b5aa50bacee96a8c Mon Sep 17 00:00:00 2001 From: frcroth Date: Wed, 28 Feb 2024 16:03:49 +0100 Subject: [PATCH 06/14] Fix is draft check --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6b5f15e2669..842f74278f8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -162,7 +162,7 @@ jobs: if [ "${CIRCLE_BRANCH}" != "master" ]; then PR_URL="$CIRCLE_PULL_REQUEST" PR_NUMBER=$(echo $PR_URL | awk -F'/' '{print $NF}') - IS_DRAFT=curl "https://api.github.com/repos/scalableminds/webknossos/pulls/$PR_NUMBER" | jq '.draft' + IS_DRAFT=$(curl "https://api.github.com/repos/scalableminds/webknossos/pulls/${PR_NUMBER}" | jq '.draft') if [ "$IS_DRAFT" == "true" ]; then echo "PR is a draft, not installing dev deployment" else From 3ef88ac717e29df764eb9b5bb7b720e52f6fe740 Mon Sep 17 00:00:00 2001 From: frcroth Date: Wed, 28 Feb 2024 17:15:14 +0100 Subject: [PATCH 07/14] Fix typo --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 842f74278f8..dac0be7ab22 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -167,7 +167,7 @@ jobs: echo "PR is a draft, not installing dev deployment" else curl -X POST -H "X-Auth-Token: $RELEASE_API_TOKEN" "https://kubernetix.scm.io/hooks/install/webknossos/dev/${CIRCLE_BRANCH}?user=CI+%28nightly%29" - echo "Installed to $NORMALIZED:BRANCH.webknossos.xyz" + echo "\nInstalled to $NORMALIZED_BRANCH.webknossos.xyz" fi fi - run: From 04f5600555aa611db8eae54c6ecb0284aab1f2a6 Mon Sep 17 00:00:00 2001 From: frcroth Date: Mon, 18 Mar 2024 10:21:18 +0100 Subject: [PATCH 08/14] Check if automerge label is set --- .circleci/config.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dac0be7ab22..cf472ab8b37 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -162,10 +162,8 @@ jobs: if [ "${CIRCLE_BRANCH}" != "master" ]; then PR_URL="$CIRCLE_PULL_REQUEST" PR_NUMBER=$(echo $PR_URL | awk -F'/' '{print $NF}') - IS_DRAFT=$(curl "https://api.github.com/repos/scalableminds/webknossos/pulls/${PR_NUMBER}" | jq '.draft') - if [ "$IS_DRAFT" == "true" ]; then - echo "PR is a draft, not installing dev deployment" - else + SHOULD_AUTOMERGE=$(curl "https://api.github.com/repos/scalableminds/webknossos/pulls/${PR_NUMBER}" | jq -e '.labels | .[] | select(.name == "autodeploy")') + if [ "$SHOULD_AUTOMERGE" == "true" ]; then curl -X POST -H "X-Auth-Token: $RELEASE_API_TOKEN" "https://kubernetix.scm.io/hooks/install/webknossos/dev/${CIRCLE_BRANCH}?user=CI+%28nightly%29" echo "\nInstalled to $NORMALIZED_BRANCH.webknossos.xyz" fi From c23f1a95815f09f48612bc1be643560611813603 Mon Sep 17 00:00:00 2001 From: frcroth Date: Mon, 18 Mar 2024 10:46:26 +0100 Subject: [PATCH 09/14] Do we have a GH Token? --- .circleci/config.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index cf472ab8b37..c063d7af55d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,6 +24,21 @@ jobs: echo "export NORMALIZED_BRANCH=master" >> $BASH_ENV echo "export DOCKER_TAG=${CIRCLE_TAG}" >> $BASH_ENV fi + - run: + name: Test GH Token + command: | + if [ -n "$GH_TOKEN" ]; then + echo "GH_TOKEN is set" + sudo mkdir -p -m 755 /etc/apt/keyrings && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \ + && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ + && sudo apt update \ + && sudo apt install gh -y + gh auth status + else + echo "GH_TOKEN is not set" + exit 1 + fi - run: name: Build webknossos-dev docker image command: | From 37057a333261e18b17c80cba63eb6686616f8827 Mon Sep 17 00:00:00 2001 From: frcroth Date: Mon, 18 Mar 2024 14:10:59 +0100 Subject: [PATCH 10/14] Update comment --- .circleci/config.yml | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c063d7af55d..e0c57e5b33c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,21 +24,6 @@ jobs: echo "export NORMALIZED_BRANCH=master" >> $BASH_ENV echo "export DOCKER_TAG=${CIRCLE_TAG}" >> $BASH_ENV fi - - run: - name: Test GH Token - command: | - if [ -n "$GH_TOKEN" ]; then - echo "GH_TOKEN is set" - sudo mkdir -p -m 755 /etc/apt/keyrings && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \ - && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ - && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ - && sudo apt update \ - && sudo apt install gh -y - gh auth status - else - echo "GH_TOKEN is not set" - exit 1 - fi - run: name: Build webknossos-dev docker image command: | @@ -177,10 +162,22 @@ jobs: if [ "${CIRCLE_BRANCH}" != "master" ]; then PR_URL="$CIRCLE_PULL_REQUEST" PR_NUMBER=$(echo $PR_URL | awk -F'/' '{print $NF}') - SHOULD_AUTOMERGE=$(curl "https://api.github.com/repos/scalableminds/webknossos/pulls/${PR_NUMBER}" | jq -e '.labels | .[] | select(.name == "autodeploy")') - if [ "$SHOULD_AUTOMERGE" == "true" ]; then + SHOULD_AUTODEPLOY=$(curl "https://api.github.com/repos/scalableminds/webknossos/pulls/${PR_NUMBER}" | jq -e '.labels | .[] | select(.name == "autodeploy")') + if [ "SHOULD_AUTODEPLOY" == "true" ]; then curl -X POST -H "X-Auth-Token: $RELEASE_API_TOKEN" "https://kubernetix.scm.io/hooks/install/webknossos/dev/${CIRCLE_BRANCH}?user=CI+%28nightly%29" echo "\nInstalled to $NORMALIZED_BRANCH.webknossos.xyz" + + # Install gh client + sudo mkdir -p -m 755 /etc/apt/keyrings && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \ + && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ + && sudo apt update \ + && sudo apt install gh -y + gh auth status + + CURRENT_BODY = $(gh pr view $PR_NUMBER --json body | jq -r '.body') + UPDATED_BODY = $(echo $CURRENT_BODY | sed "s|https://___.webknossos.xyz|https://$NORMALIZED_BRANCH.webknossos.xyz|g") + gh pr edit $PR_NUMBER --body $UPDATED_BODY fi fi - run: From 1d333db6cdef02af29a51fe414bf2d820fc77842 Mon Sep 17 00:00:00 2001 From: frcroth Date: Mon, 18 Mar 2024 14:27:45 +0100 Subject: [PATCH 11/14] Add more echos --- .circleci/config.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index e0c57e5b33c..73d4a90b290 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -163,6 +163,7 @@ jobs: PR_URL="$CIRCLE_PULL_REQUEST" PR_NUMBER=$(echo $PR_URL | awk -F'/' '{print $NF}') SHOULD_AUTODEPLOY=$(curl "https://api.github.com/repos/scalableminds/webknossos/pulls/${PR_NUMBER}" | jq -e '.labels | .[] | select(.name == "autodeploy")') + echo "SHOULD_AUTODEPLOY=$SHOULD_AUTODEPLOY" if [ "SHOULD_AUTODEPLOY" == "true" ]; then curl -X POST -H "X-Auth-Token: $RELEASE_API_TOKEN" "https://kubernetix.scm.io/hooks/install/webknossos/dev/${CIRCLE_BRANCH}?user=CI+%28nightly%29" echo "\nInstalled to $NORMALIZED_BRANCH.webknossos.xyz" @@ -176,7 +177,10 @@ jobs: gh auth status CURRENT_BODY = $(gh pr view $PR_NUMBER --json body | jq -r '.body') + echo "CURRENT_BODY=$CURRENT_BODY" UPDATED_BODY = $(echo $CURRENT_BODY | sed "s|https://___.webknossos.xyz|https://$NORMALIZED_BRANCH.webknossos.xyz|g") + echo "UPDATED_BODY=$UPDATED_BODY" + gh pr edit $PR_NUMBER --body $UPDATED_BODY fi fi From 0878b50faf55743bacaa91ed0c8140402c09f991 Mon Sep 17 00:00:00 2001 From: frcroth Date: Mon, 18 Mar 2024 14:48:22 +0100 Subject: [PATCH 12/14] Fix check --- .circleci/config.yml | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 73d4a90b290..a4ab64ca200 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -163,26 +163,27 @@ jobs: PR_URL="$CIRCLE_PULL_REQUEST" PR_NUMBER=$(echo $PR_URL | awk -F'/' '{print $NF}') SHOULD_AUTODEPLOY=$(curl "https://api.github.com/repos/scalableminds/webknossos/pulls/${PR_NUMBER}" | jq -e '.labels | .[] | select(.name == "autodeploy")') - echo "SHOULD_AUTODEPLOY=$SHOULD_AUTODEPLOY" - if [ "SHOULD_AUTODEPLOY" == "true" ]; then - curl -X POST -H "X-Auth-Token: $RELEASE_API_TOKEN" "https://kubernetix.scm.io/hooks/install/webknossos/dev/${CIRCLE_BRANCH}?user=CI+%28nightly%29" - echo "\nInstalled to $NORMALIZED_BRANCH.webknossos.xyz" + if [ "$?" -eq "0" ] + then + echo "Starting autodeploy" + curl -X POST -H "X-Auth-Token: $RELEASE_API_TOKEN" "https://kubernetix.scm.io/hooks/install/webknossos/dev/${CIRCLE_BRANCH}?user=CI+%28nightly%29" + echo "\nInstalled to $NORMALIZED_BRANCH.webknossos.xyz" - # Install gh client - sudo mkdir -p -m 755 /etc/apt/keyrings && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \ - && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ - && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ - && sudo apt update \ - && sudo apt install gh -y - gh auth status + # Install gh client + sudo mkdir -p -m 755 /etc/apt/keyrings && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \ + && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ + && sudo apt update \ + && sudo apt install gh -y + gh auth status - CURRENT_BODY = $(gh pr view $PR_NUMBER --json body | jq -r '.body') - echo "CURRENT_BODY=$CURRENT_BODY" - UPDATED_BODY = $(echo $CURRENT_BODY | sed "s|https://___.webknossos.xyz|https://$NORMALIZED_BRANCH.webknossos.xyz|g") - echo "UPDATED_BODY=$UPDATED_BODY" + CURRENT_BODY = $(gh pr view $PR_NUMBER --json body | jq -r '.body') + echo "CURRENT_BODY=$CURRENT_BODY" + UPDATED_BODY = $(echo $CURRENT_BODY | sed "s|https://___.webknossos.xyz|https://$NORMALIZED_BRANCH.webknossos.xyz|g") + echo "UPDATED_BODY=$UPDATED_BODY" - gh pr edit $PR_NUMBER --body $UPDATED_BODY - fi + gh pr edit $PR_NUMBER --body $UPDATED_BODY + fi fi - run: name: Send Slack notification (master only) From e432d88aa03df9deaf0d45aeb39eaa6377f22ffe Mon Sep 17 00:00:00 2001 From: frcroth Date: Mon, 18 Mar 2024 17:02:27 +0100 Subject: [PATCH 13/14] Remove spaces because bash is madness --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a4ab64ca200..69e538c75ef 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -177,9 +177,9 @@ jobs: && sudo apt install gh -y gh auth status - CURRENT_BODY = $(gh pr view $PR_NUMBER --json body | jq -r '.body') + CURRENT_BODY=$(gh pr view $PR_NUMBER --json body | jq -r '.body') echo "CURRENT_BODY=$CURRENT_BODY" - UPDATED_BODY = $(echo $CURRENT_BODY | sed "s|https://___.webknossos.xyz|https://$NORMALIZED_BRANCH.webknossos.xyz|g") + UPDATED_BODY=$(echo $CURRENT_BODY | sed "s|https://___.webknossos.xyz|https://$NORMALIZED_BRANCH.webknossos.xyz|g") echo "UPDATED_BODY=$UPDATED_BODY" gh pr edit $PR_NUMBER --body $UPDATED_BODY From 48766bd975e7f90aabe4c529b2135026156a391d Mon Sep 17 00:00:00 2001 From: frcroth Date: Mon, 18 Mar 2024 17:16:21 +0100 Subject: [PATCH 14/14] Fix body input --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 69e538c75ef..5e26d257465 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -182,7 +182,7 @@ jobs: UPDATED_BODY=$(echo $CURRENT_BODY | sed "s|https://___.webknossos.xyz|https://$NORMALIZED_BRANCH.webknossos.xyz|g") echo "UPDATED_BODY=$UPDATED_BODY" - gh pr edit $PR_NUMBER --body $UPDATED_BODY + echo $UPDATED_BODY | gh pr edit $PR_NUMBER -F - fi fi - run: