Skip to content

Add automatic dev deployment on push #7657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
26 changes: 26 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,32 @@ jobs:
retry docker push scalableminds/webknossos-dev:${NORMALIZED_BRANCH}
fi
docker logout
- run:
name: Install dev deployment
command: |
if [ "${CIRCLE_BRANCH}" != "master" ]; then
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")')
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
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"
echo $UPDATED_BODY | gh pr edit $PR_NUMBER -F -
fi
fi
- run:
name: Report coverage
command: .circleci/not-on-master.sh docker-compose run base yarn coverage || true
Expand Down