Skip to content

Commit 81115f7

Browse files
authored
Change the gid to 1001 (#51)
The jammy stack has no default user or group configured, but with Noble there is a default user and group. These are assigned to uid and gid 1000. The uid was previously changed to 1001 (build) and 1002 (run), but the gid was not changed. This changes the gid to 1001 (from 1000), so that it does not collide with the default gid that is in the image Signed-off-by: Daniel Mikusa <dan@mikusa.com>
1 parent b88fdf2 commit 81115f7

6 files changed

Lines changed: 19 additions & 19 deletions

File tree

metadata_base_stack_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,16 @@ func testMetadataBaseStack(t *testing.T, context spec.G, it spec.S) {
8787
Expect(buildReleaseDate).NotTo(BeZero())
8888

8989
Expect(image).To(SatisfyAll(
90-
HaveFileWithContent("/etc/group", ContainSubstring("cnb:x:1000:")),
91-
HaveFileWithContent("/etc/passwd", ContainSubstring("cnb:x:1001:1000::/home/cnb:/bin/bash")),
90+
HaveFileWithContent("/etc/group", ContainSubstring("cnb:x:1001:")),
91+
HaveFileWithContent("/etc/passwd", ContainSubstring("cnb:x:1001:1001::/home/cnb:/bin/bash")),
9292
HaveDirectory("/home/cnb"),
9393
))
9494

95-
Expect(file.Config.User).To(Equal("1001:1000"))
95+
Expect(file.Config.User).To(Equal("1001:1001"))
9696

9797
Expect(file.Config.Env).To(ContainElements(
9898
"CNB_USER_ID=1001",
99-
"CNB_GROUP_ID=1000",
99+
"CNB_GROUP_ID=1001",
100100
"CNB_STACK_ID=io.buildpacks.stacks.noble",
101101
))
102102

@@ -177,11 +177,11 @@ func testMetadataBaseStack(t *testing.T, context spec.G, it spec.S) {
177177
Expect(err).NotTo(HaveOccurred())
178178
Expect(runReleaseDate).NotTo(BeZero())
179179

180-
Expect(file.Config.User).To(Equal("1002:1000"))
180+
Expect(file.Config.User).To(Equal("1002:1001"))
181181

182182
Expect(image).To(SatisfyAll(
183-
HaveFileWithContent("/etc/group", ContainSubstring("cnb:x:1000:")),
184-
HaveFileWithContent("/etc/passwd", ContainSubstring("cnb:x:1002:1000::/home/cnb:/bin/bash")),
183+
HaveFileWithContent("/etc/group", ContainSubstring("cnb:x:1001:")),
184+
HaveFileWithContent("/etc/passwd", ContainSubstring("cnb:x:1002:1001::/home/cnb:/bin/bash")),
185185
HaveDirectory("/home/cnb"),
186186
))
187187

metadata_static_stack_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ func testMetadataStaticStack(t *testing.T, context spec.G, it spec.S) {
9393
Expect(err).NotTo(HaveOccurred())
9494
Expect(runReleaseDate).NotTo(BeZero())
9595

96-
Expect(file.Config.User).To(Equal("1002:1000"))
96+
Expect(file.Config.User).To(Equal("1002:1001"))
9797

9898
Expect(image).To(SatisfyAll(
99-
HaveFileWithContent("/etc/group", ContainSubstring("cnb:x:1000:")),
100-
HaveFileWithContent("/etc/passwd", ContainSubstring("cnb:x:1002:1000::/home/cnb:/sbin/nologin")),
99+
HaveFileWithContent("/etc/group", ContainSubstring("cnb:x:1001:")),
100+
HaveFileWithContent("/etc/passwd", ContainSubstring("cnb:x:1002:1001::/home/cnb:/sbin/nologin")),
101101
HaveDirectory("/home/cnb"),
102102
))
103103

metadata_tiny_stack_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ func testMetadataTinyStack(t *testing.T, context spec.G, it spec.S) {
9393
Expect(err).NotTo(HaveOccurred())
9494
Expect(runReleaseDate).NotTo(BeZero())
9595

96-
Expect(file.Config.User).To(Equal("1002:1000"))
96+
Expect(file.Config.User).To(Equal("1002:1001"))
9797

9898
Expect(image).To(SatisfyAll(
99-
HaveFileWithContent("/etc/group", ContainSubstring("cnb:x:1000:")),
100-
HaveFileWithContent("/etc/passwd", ContainSubstring("cnb:x:1002:1000::/home/cnb:/sbin/nologin")),
99+
HaveFileWithContent("/etc/group", ContainSubstring("cnb:x:1001:")),
100+
HaveFileWithContent("/etc/passwd", ContainSubstring("cnb:x:1002:1001::/home/cnb:/sbin/nologin")),
101101
HaveDirectory("/home/cnb"),
102102
))
103103

stacks/noble-base-stack/stack.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ platforms = ["linux/amd64", "linux/arm64"]
77
[build]
88
description = "ubuntu:noble with compilers and shell utilities"
99
dockerfile = "./build.Dockerfile"
10-
gid = 1000
10+
gid = 1001
1111
shell = "/bin/bash"
1212
uid = 1001
1313

@@ -60,7 +60,7 @@ Components: main universe multiverse
6060
[run]
6161
description = "ubuntu:noble with some common dependencies like tzdata and openssl"
6262
dockerfile = "./run.Dockerfile"
63-
gid = 1000
63+
gid = 1001
6464
shell = "/bin/bash"
6565
uid = 1002
6666

stacks/noble-static-stack/stack.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ platforms = ["linux/amd64", "linux/arm64"]
77
[build]
88
description = "ubuntu:noble with compilers and shell utilities"
99
dockerfile = "./build.Dockerfile"
10-
gid = 1000
10+
gid = 1001
1111
shell = "/bin/bash"
1212
uid = 1001
1313

@@ -58,7 +58,7 @@ Components: main universe multiverse
5858
[run]
5959
description = "noble for statically-linked applications containing tzdata and ca-certificates"
6060
dockerfile = "./run/run.Dockerfile"
61-
gid = 1000
61+
gid = 1001
6262
shell = "/sbin/nologin"
6363
uid = 1002
6464

stacks/noble-tiny-stack/stack.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ platforms = ["linux/amd64", "linux/arm64"]
77
[build]
88
description = "ubuntu:noble with compilers and shell utilities"
99
dockerfile = "./build.Dockerfile"
10-
gid = 1000
10+
gid = 1001
1111
shell = "/bin/bash"
1212
uid = 1001
1313

@@ -58,7 +58,7 @@ Components: main universe multiverse
5858
[run]
5959
description = "distroless-like noble"
6060
dockerfile = "./run/run.Dockerfile"
61-
gid = 1000
61+
gid = 1001
6262
shell = "/sbin/nologin"
6363
uid = 1002
6464

0 commit comments

Comments
 (0)