Check out a common branch through environment var

This will be useful if we trigger the build through the Travis CI API
where we can alter the environment variables in the request.
This commit is contained in:
Robert Schäfer 2018-12-09 23:23:36 +01:00
parent f43458ba3d
commit 0a8aadbb2d
2 changed files with 32 additions and 1 deletions

View File

@ -9,7 +9,9 @@ services:
- docker
env:
- DOCKER_COMPOSE_VERSION=1.23.2
global:
- DOCKER_COMPOSE_VERSION=1.23.2
- COMMON_BRANCH=master
before_install:
- sudo rm /usr/local/bin/docker-compose
@ -18,6 +20,7 @@ before_install:
- sudo mv docker-compose /usr/local/bin
install:
- git submodule foreach "git checkout $COMMON_BRANCH || echo 'Branch \`$COMMON_BRANCH\` does not exist, falling back to master.'"
- docker-compose -f Nitro-Backend/docker-compose.yml up -d
- docker-compose -f Nitro-Web/docker-compose.yml up -d
- yarn global add cypress wait-on

28
scripts/trigger.sh Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env bash
body=$(cat<< EOF
{
"request": {
"branch":"e2e",
"message": "Triggered by \`$TRAVIS_REPO_SLUG\` on \`$TRAVIS_BRANCH\`",
"config": {
"merge_mode": "deep_merge",
"env": {
"global": {
"DOCKER_COMPOSE_VERSION":"1.23.2",
"COMMON_BRANCH": "$TRAVIS_BRANCH"
}
}
}
}
}
EOF
)
curl -s -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Travis-API-Version: 3" \
-H "Authorization: token $TRAVIS_TOKEN" \
-d "$body" \
https://api.travis-ci.com/repo/Human-Connection%2FHuman-Connection/requests