Skip to content

Commit ba67a70

Browse files
mkocheraramprice
authored andcommitted
assorted pipeline and test improvements
* add bpm to acceptance test manifests as syslog will depend on it * remove --all from cleanup - the pipeline already runs `bosh clean-up --all` in the teardown step. Removing this allows BPM to be uploaded once. It also makes the tests faster as the releases don't have to be recompiled for each suite. * better pam error logging, handle Resolute `sa1` location * fix libpam-lastlog2 - this seems like a bug in the libpam-lastlog2 package
1 parent 85df148 commit ba67a70

9 files changed

Lines changed: 47 additions & 5 deletions

File tree

acceptance-tests/ipv4director/smoke/manifest.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ name: stemcell-acceptance-tests
44
releases:
55
- name: syslog
66
version: latest
7+
- name: bpm
8+
version: latest
79

810
stemcells:
911
- alias: default
@@ -25,6 +27,8 @@ instance_groups:
2527
- {name: default}
2628
azs: [z1]
2729
jobs:
30+
- name: bpm
31+
release: bpm
2832
- name: syslog_forwarder
2933
release: syslog
3034
properties:

acceptance-tests/ipv4director/smoke/smoke_test.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,16 @@ var _ = Describe("Stemcell", func() {
8383

8484
contents, err := io.ReadAll(tempFile)
8585
Expect(err).ToNot(HaveOccurred())
86-
Expect(contents).ToNot(ContainSubstring("No such file or directory"))
86+
87+
// Extract only the offending lines so failures are readable (auth.log can be
88+
// hundreds of kilobytes and Gomega truncates the full-content diff).
89+
var offending []string
90+
for _, line := range strings.Split(string(contents), "\n") {
91+
if strings.Contains(line, "No such file or directory") {
92+
offending = append(offending, line)
93+
}
94+
}
95+
Expect(offending).To(BeEmpty(), "auth.log contained 'No such file or directory':\n%s", strings.Join(offending, "\n"))
8796
})
8897

8998
It("#141987897: disables ipv6 in the kernel", func() {
@@ -97,8 +106,11 @@ var _ = Describe("Stemcell", func() {
97106
_, _, exitStatus, err := bosh.Run(
98107
"--column=stdout",
99108
"ssh", "default/0", "-r", "-c",
100-
// sleep to ensure we have multiple samples so average can be verified
101-
`sudo /usr/lib/sysstat/sa1 && sudo /usr/lib/sysstat/sa1 1 1 && sleep 2`,
109+
// Ubuntu 26.04+ relocated sa1 to /usr/libexec/sysstat/; fall back to the
110+
// legacy path for older releases. sleep ensures multiple samples for the
111+
// Average: check.
112+
`SA1=$(ls /usr/lib/sysstat/sa1 /usr/libexec/sysstat/sa1 2>/dev/null | head -1) && `+
113+
`sudo "$SA1" && sudo "$SA1" 1 1 && sleep 2`,
102114
)
103115
Expect(err).ToNot(HaveOccurred())
104116
Expect(exitStatus).To(Equal(0))

acceptance-tests/ipv4director/syslogrelease/manifest.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ name: stemcell-acceptance-tests
44
releases:
55
- name: syslog
66
version: latest
7+
- name: bpm
8+
version: latest
79

810
stemcells:
911
- alias: default
@@ -40,6 +42,8 @@ instance_groups:
4042
networks:
4143
- {name: default}
4244
jobs:
45+
- name: bpm
46+
release: bpm
4347
- name: syslog_forwarder
4448
release: syslog
4549
consumes:

acceptance-tests/ipv4director/syslogrelease/smoke_suite_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ var _ = BeforeSuite(func() {
2222
bosh = testhelpers.NewBOSH()
2323
stemcellPath := testhelpers.RequireEnv("STEMCELL_PATH")
2424
syslogReleasePath := testhelpers.RequireEnv("SYSLOG_RELEASE_PATH")
25+
bpmReleasePath := testhelpers.RequireEnv("BPM_RELEASE_PATH")
2526

2627
bosh.UploadStemcell(stemcellPath)
2728
bosh.UploadRelease(syslogReleasePath)
29+
bosh.UploadRelease(bpmReleasePath)
2830
bosh.SafeDeploy()
2931
})
3032

acceptance-tests/testhelpers/bosh.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (b *BOSH) Teardown() {
3535
Expect(err).ToNot(HaveOccurred())
3636
Expect(exitStatus).To(Equal(0), fmt.Sprintf("stdOut: %s \n stdErr: %s", stdOut, stdErr))
3737

38-
stdOut, stdErr, exitStatus, err = b.Run("clean-up", "--all")
38+
stdOut, stdErr, exitStatus, err = b.Run("clean-up")
3939
Expect(err).ToNot(HaveOccurred())
4040
Expect(exitStatus).To(Equal(0), fmt.Sprintf("stdOut: %s \n stdErr: %s", stdOut, stdErr))
4141
}

ci/pipelines/builder.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,10 +1098,11 @@ resources:
10981098
type: git
10991099
source:
11001100
branch: (@= data.values.stemcell_details.branch @)
1101+
uri: https://github.com/cloudfoundry/bosh-linux-stemcell-builder.git
11011102
paths:
11021103
- ci
11031104
- .ruby-version
1104-
uri: https://github.com/cloudfoundry/bosh-linux-stemcell-builder
1105+
- acceptance-tests
11051106

11061107
- name: bats
11071108
type: git
@@ -1133,6 +1134,12 @@ resources:
11331134
type: bosh-io-release
11341135
source:
11351136
repository: cloudfoundry/os-conf-release
1137+
1138+
- name: bpm-release
1139+
type: bosh-io-release
1140+
source:
1141+
repository: cloudfoundry/bpm-release
1142+
11361143
- name: bosh-deployment
11371144
type: git
11381145
source:

ci/tasks/test-stemcell.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ BOSH_CLIENT_SECRET="$(bosh int "${REPO_PARENT}/director-state/director-creds.yml
1616
BOSH_ENVIRONMENT="$(bosh int "${REPO_PARENT}/director-state/director-creds.yml" --path /internal_ip)"
1717
SYSLOG_RELEASE_PATH="$(realpath "${REPO_PARENT}/syslog-release"/*.tgz)"
1818
OS_CONF_RELEASE_PATH="$(realpath "${REPO_PARENT}/os-conf-release"/*.tgz)"
19+
BPM_RELEASE_PATH="$(realpath "${REPO_PARENT}/bpm-release"/*.tgz)"
1920
STEMCELL_PATH="$(realpath "${REPO_PARENT}/stemcell"/*.tgz)"
2021
# Quote value since the bosh CLI YAML parses it which results in `0.40` becoming `0.4`
2122
# shellcheck disable=SC2089
@@ -28,6 +29,7 @@ export BOSH_CLIENT_SECRET
2829
export BOSH_ENVIRONMENT
2930
export SYSLOG_RELEASE_PATH
3031
export OS_CONF_RELEASE_PATH
32+
export BPM_RELEASE_PATH
3133
export STEMCELL_PATH
3234
export BOSH_stemcell_version
3335

ci/tasks/test-stemcell.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ inputs:
77
- name: stemcell
88
- name: syslog-release
99
- name: os-conf-release
10+
- name: bpm-release
1011
- name: director-state
1112

1213
params:

stemcell_builder/stages/password_policies/apply.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ patch -p1 $chroot/etc/pam.d/common-auth < $assets_dir/ubuntu/common-auth.patch
3333
strip_trailing_whitespace_from $chroot/etc/pam.d/common-password
3434
patch -p1 $chroot/etc/pam.d/common-password < $assets_dir/ubuntu/common-password.patch
3535

36+
# libpam-lastlog2 installs pam_lastlog2.so only to the multiarch path
37+
# (/usr/lib/x86_64-linux-gnu/security/) but PAM's securedir is /usr/lib/security/.
38+
# Bridge the gap so PAM can load the module referenced above.
39+
if [ -f "$chroot/usr/lib/x86_64-linux-gnu/security/pam_lastlog2.so" ] && \
40+
[ ! -e "$chroot/usr/lib/security/pam_lastlog2.so" ]; then
41+
mkdir -p "$chroot/usr/lib/security"
42+
ln -sf /usr/lib/x86_64-linux-gnu/security/pam_lastlog2.so \
43+
"$chroot/usr/lib/security/pam_lastlog2.so"
44+
fi
45+
3646
strip_trailing_whitespace_from $chroot/etc/pam.d/login
3747
patch $chroot/etc/pam.d/login < $assets_dir/ubuntu/login.patch
3848

0 commit comments

Comments
 (0)