Skip to content

Commit

Permalink
Autodeployment script injects GITHUB_TOKEN into environment
Browse files Browse the repository at this point in the history
  • Loading branch information
TDDR committed Feb 17, 2022
1 parent f5785c6 commit a789d2d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
1 change: 1 addition & 0 deletions docker/docker-compose.yml
Expand Up @@ -24,6 +24,7 @@ services:
- JWT_ISSUER
- JWT_AUDIENCE
- SECRET
- GITHUB_TOKEN
depends_on:
- traefik
- redis
Expand Down
21 changes: 13 additions & 8 deletions tools/autodeployment/builds.js
Expand Up @@ -73,19 +73,24 @@ function run() {
// Promote the next build to current and start it
const build = builds.pending;
const { cache } = build;
const { GITHUB_TOKEN } = process.env;

builds.current = build;
builds.pending = null;

logger.debug('run() called, starting pending build');
build.proc = shell.exec(`./deploy.sh ${build.type} ${build.sha}`, { silent: true }, (code) => {
build.finish(code);
builds.previous = builds.current;
builds.current = null;

// See if there's another build ready to go
run();
});
build.proc = shell.exec(
`./deploy.sh ${build.type} ${build.sha} ${GITHUB_TOKEN}`,
{ silent: true },
(code) => {
build.finish(code);
builds.previous = builds.current;
builds.current = null;

// See if there's another build ready to go
run();
}
);

// Combine stderr and stdout, like 2>&1
build.out = mergeStream(build.proc.stdout, build.proc.stderr);
Expand Down
2 changes: 1 addition & 1 deletion tools/autodeployment/deploy.sh
Expand Up @@ -44,7 +44,7 @@ echo "Deleting $OLD Volumes"
docker volume prune -f

echo "Starting $ENV Environment"
docker-compose --env-file $ENV_FILE --project-name=$ENV up -d
GITHUB_TOKEN=$3 docker-compose --env-file $ENV_FILE --project-name=$ENV up -d

echo "Removing dangling images"
docker rmi $(docker images -f "dangling=true" -q)
Expand Down
3 changes: 3 additions & 0 deletions tools/autodeployment/env.example
Expand Up @@ -16,3 +16,6 @@ UNSPLASH_CLIENT_ID=

# Path to certificates
PATH_TO_CERTS=

# github access token
GITHUB_TOKEN=

0 comments on commit a789d2d

Please sign in to comment.