Skip to content
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
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ on:
push:
branches:
- main
paths-ignore:
- "launcher_go/**"
- ".github/workflows/launcher_go.yml"
pull_request:
paths-ignore:
- "launcher_go/**"
- ".github/workflows/launcher_go.yml"
schedule:
- cron: "0 0 * * *"

Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/launcher_go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: launcher_go

on:
push:
branches:
- main
paths:
- "launcher_go/**"
- ".github/workflows/launcher_go.yml"
pull_request:
paths:
- "launcher_go/**"
- ".github/workflows/launcher_go.yml"

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ">=1.21.0"
- name: Run gofmt
working-directory: ./launcher_go/v2
run: |
if [ "$(gofmt -l . | wc -l)" -gt 0 ]; then
exit 1
fi

test:
runs-on: ${{ matrix.os }}
timeout-minutes: 5
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ">=1.21.0"
- name: Run tests
working-directory: ./launcher_go/v2
run: go test ./...
12 changes: 7 additions & 5 deletions launcher_go/v2/cli_build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ var _ = Describe("Build", func() {
TemplatesDir: "./test",
BuildDir: testDir,
}

utils.CmdRunner = CreateNewFakeCmdRunner()
})

AfterEach(func() {
os.RemoveAll(testDir)
})
Expand Down Expand Up @@ -72,8 +74,8 @@ var _ = Describe("Build", func() {
}

var checkConfigureCmd = func(cmd exec.Cmd) {
Expect(cmd.String()).To(Equal(
"/usr/local/bin/docker run " +
Expect(cmd.String()).To(ContainSubstring(
"docker run " +
"--env DISCOURSE_DB_HOST " +
"--env DISCOURSE_DB_PASSWORD " +
"--env DISCOURSE_DB_PORT " +
Expand Down Expand Up @@ -143,8 +145,8 @@ var _ = Describe("Build", func() {
// commit on configure
var checkConfigureCommit = func(cmd exec.Cmd) {
Expect(cmd.String()).To(MatchRegexp(
"/usr/local/bin/docker commit " +
`--change LABEL org\.opencontainers\.image\.created="[\d\-T:+]+" ` +
"docker commit " +
`--change LABEL org\.opencontainers\.image\.created="[\d\-T:Z]+" ` +
`--change CMD \["/sbin/boot"\] ` +
"discourse-build-test local_discourse/test",
))
Expand All @@ -154,7 +156,7 @@ var _ = Describe("Build", func() {

// configure also cleans up
var checkConfigureClean = func(cmd exec.Cmd) {
Expect(cmd.String()).To(Equal("/usr/local/bin/docker rm --force discourse-build-test"))
Expect(cmd.String()).To(ContainSubstring("docker rm --force discourse-build-test"))
}

It("Should run docker build with correct arguments", func() {
Expand Down
2 changes: 1 addition & 1 deletion launcher_go/v2/docker/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func (r *DockerPupsRunner) Run() error {
cmd := exec.Command("docker",
"commit",
"--change",
"LABEL org.opencontainers.image.created=\""+time.Now().Format(time.RFC3339)+"\"",
"LABEL org.opencontainers.image.created=\""+time.Now().UTC().Format(time.RFC3339)+"\"",
"--change",
"CMD [\""+r.Config.BootCommand()+"\"]",
r.ContainerId,
Expand Down
Loading