Skip to content
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

add autosetup #51

Merged
merged 1 commit into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/deploy-develop-branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy to develop

on:
pull_request:
types: [unlabeled]

jobs:
get-removed-labels:
runs-on: ubuntu-latest
steps:
- name: Get the removed label
run: |
# The path to the JSON file with the event payload
EVENT_PAYLOAD_PATH=${{ github.event_path }}

# Extract the label name using jq (a lightweight and flexible command-line JSON processor)
LABEL_NAME=$(jq '.label.name' $EVENT_PAYLOAD_PATH)

# Output the label name
echo $LABEL_NAME

# Deploy to develop to test server
deploy:
needs: [ get-removed-labels ]
uses: ./.github/workflows/deploy.yaml
if: ${{ needs.get-removed-labels.outputs.result }} == 'deploy:aeolus-test' || ${{ needs.get-removed-labels.outputs.result }} == 'lock:aeolus-test'
with:
docker-tag: "nightly"
branch-name: "develop"
environment-name: aeolus-dev
environment-url: https://aeolus-test.artemis.cit.tum.de
secrets: inherit


# Check that the build job has run successfully otherwise add an error label
add-error-label:
needs: [ deploy ]
runs-on: ubuntu-latest
if: ${{ failure() }}
steps:
- name: Add error label
uses: actions-ecosystem/action-add-labels@v1
with:
labels: deployment-error
10 changes: 8 additions & 2 deletions deployment/aeolus-docker
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ function start {
cd $WORKING_DIR || exit
git clone https://github.com/ls1intum/Aeolus.git -b "$pr_branch" Aeolus
sed -i "s/AEOLUS_DOCKER_TAG=.*/AEOLUS_DOCKER_TAG='$pr_tag'/g" $ENV_FILE
if [ ! -f "$WORKING_DIR/docker.env" ]; then
wget -O "$WORKING_DIR/docker.env" https://raw.githubusercontent.com/ls1intum/Aeolus/develop/.env.example
sed -i "s/AEOLUS_DOCKER_TAG=.*/AEOLUS_DOCKER_TAG='$pr_tag'/g" $WORKING_DIR/docker.env
local _hostname
_hostname=$(hostname)
sed -i "s/AEOLUS_HOST=.*/AEOLUS_HOST='${_hostname}'/g" $WORKING_DIR/docker.env
fi
if [ ! -f "$WORKING_DIR/acme.json" ]; then
touch "$WORKING_DIR/acme.json"
chmod 600 "$WORKING_DIR/acme.json"
Expand All @@ -42,14 +49,13 @@ function start {
}

function stop {
# TODO: In the future extract pr_tag and pr_branch from env

echo "Stopping aeolus"
docker compose -f "$PROJECT_DIR/$COMPOSE_FILE" --env-file "$ENV_FILE" down
}

function restart {
stop "$@"
sleep 1
start "$@"
}

Expand Down
Loading