Skip to content

Commit 85a6e38

Browse files
FEATURE: Add workflow for launcher_go (#848)
1 parent b7e54ed commit 85a6e38

File tree

4 files changed

+61
-6
lines changed

4 files changed

+61
-6
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ on:
22
push:
33
branches:
44
- main
5+
paths-ignore:
6+
- "launcher_go/**"
7+
- ".github/workflows/launcher_go.yml"
58
pull_request:
9+
paths-ignore:
10+
- "launcher_go/**"
11+
- ".github/workflows/launcher_go.yml"
612
schedule:
713
- cron: "0 0 * * *"
814

.github/workflows/launcher_go.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: launcher_go
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "launcher_go/**"
9+
- ".github/workflows/launcher_go.yml"
10+
pull_request:
11+
paths:
12+
- "launcher_go/**"
13+
- ".github/workflows/launcher_go.yml"
14+
15+
jobs:
16+
lint:
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 5
19+
strategy:
20+
fail-fast: true
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: actions/setup-go@v5
24+
with:
25+
go-version: ">=1.21.0"
26+
- name: Run gofmt
27+
working-directory: ./launcher_go/v2
28+
run: |
29+
if [ "$(gofmt -l . | wc -l)" -gt 0 ]; then
30+
exit 1
31+
fi
32+
33+
test:
34+
runs-on: ${{ matrix.os }}
35+
timeout-minutes: 5
36+
strategy:
37+
fail-fast: true
38+
matrix:
39+
os: [ubuntu-latest, macos-latest]
40+
steps:
41+
- uses: actions/checkout@v4
42+
- uses: actions/setup-go@v5
43+
with:
44+
go-version: ">=1.21.0"
45+
- name: Run tests
46+
working-directory: ./launcher_go/v2
47+
run: go test ./...

launcher_go/v2/cli_build_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ var _ = Describe("Build", func() {
3535
TemplatesDir: "./test",
3636
BuildDir: testDir,
3737
}
38+
3839
utils.CmdRunner = CreateNewFakeCmdRunner()
3940
})
41+
4042
AfterEach(func() {
4143
os.RemoveAll(testDir)
4244
})
@@ -72,8 +74,8 @@ var _ = Describe("Build", func() {
7274
}
7375

7476
var checkConfigureCmd = func(cmd exec.Cmd) {
75-
Expect(cmd.String()).To(Equal(
76-
"/usr/local/bin/docker run " +
77+
Expect(cmd.String()).To(ContainSubstring(
78+
"docker run " +
7779
"--env DISCOURSE_DB_HOST " +
7880
"--env DISCOURSE_DB_PASSWORD " +
7981
"--env DISCOURSE_DB_PORT " +
@@ -143,8 +145,8 @@ var _ = Describe("Build", func() {
143145
// commit on configure
144146
var checkConfigureCommit = func(cmd exec.Cmd) {
145147
Expect(cmd.String()).To(MatchRegexp(
146-
"/usr/local/bin/docker commit " +
147-
`--change LABEL org\.opencontainers\.image\.created="[\d\-T:+]+" ` +
148+
"docker commit " +
149+
`--change LABEL org\.opencontainers\.image\.created="[\d\-T:Z]+" ` +
148150
`--change CMD \["/sbin/boot"\] ` +
149151
"discourse-build-test local_discourse/test",
150152
))
@@ -154,7 +156,7 @@ var _ = Describe("Build", func() {
154156

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

160162
It("Should run docker build with correct arguments", func() {

launcher_go/v2/docker/commands.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ func (r *DockerPupsRunner) Run() error {
270270
cmd := exec.Command("docker",
271271
"commit",
272272
"--change",
273-
"LABEL org.opencontainers.image.created=\""+time.Now().Format(time.RFC3339)+"\"",
273+
"LABEL org.opencontainers.image.created=\""+time.Now().UTC().Format(time.RFC3339)+"\"",
274274
"--change",
275275
"CMD [\""+r.Config.BootCommand()+"\"]",
276276
r.ContainerId,

0 commit comments

Comments
 (0)