Skip to content

Commit

Permalink
Add the ability to recompile additional binaries (#226)
Browse files Browse the repository at this point in the history
```
ws recompile cmd/test
```
will rebuild cmd/test package as cmd-test command, like the docker build does
  • Loading branch information
andytson-inviqa authored Jul 6, 2022
1 parent 04c7f51 commit adfb1b2
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions harness/config/commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,24 @@ command('recompile'):
.my127ws/harness/scripts/docker/compose-exec.sh go build -o /go/bin/app .
passthru docker-compose restart app
command('recompile <binary>'):
env:
COMPOSE_PROJECT_NAME: = @('namespace')
COMPOSE_DOCKER_CLI_BUILD: "1"
DOCKER_BUILDKIT: "1"
BINARAY: = input.argument('binary')
SANITISED_BINARY: = sanitize_additional_binary_path(input.argument('binary'))
exec: |
#!bash(workspace:/)|@
if ! docker-compose ps --services --filter "status=running" | grep -Fxe app >/dev/null; then
echo "rebuilding app container" >&2
passthru docker-compose up -d --build app
fi
echo "go mod download" >&2
.my127ws/harness/scripts/docker/compose-exec.sh go mod download
echo "go build -o /go/bin/$SANITISED_BINARY ./$BINARAY" >&2
.my127ws/harness/scripts/docker/compose-exec.sh go build -o "/go/bin/$SANITISED_BINARY" "./$BINARAY"
command('use prod'):
env:
COMPOSE_PROJECT_NAME: = @('namespace')
Expand Down

0 comments on commit adfb1b2

Please sign in to comment.