Skip to content

Commit 358d197

Browse files
committed
jobs/bump-lockfile: use locally scoped arch var
I was seeing some issues where the `arch` variable was getting evalated lazily and all three of my parallel runs were all executing against the same architecture. Adding a locally scoped arch variable seems to fix it.
1 parent 319d2b3 commit 358d197

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

jobs/bump-lockfile.Jenkinsfile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ try { lock(resource: "bump-${params.STREAM}") { timeout(time: 120, unit: 'MINUTE
6969

7070
def lockfile, pkgChecksum, pkgTimestamp
7171
def archinfo = [x86_64: [:], aarch64: [:], s390x: [:]]
72-
for (arch in archinfo.keySet()) {
72+
for (architecture in archinfo.keySet()) {
73+
def arch = architecture
7374
// initialize some data
7475
archinfo[arch]['session'] = ""
7576
lockfile = "src/config/manifest-lock.${arch}.json"
@@ -100,7 +101,8 @@ try { lock(resource: "bump-${params.STREAM}") { timeout(time: 120, unit: 'MINUTE
100101

101102
// Initialize the sessions on the remote builders
102103
stage("Initialize Remotes") {
103-
for (arch in archinfo.keySet()) {
104+
for (architecture in archinfo.keySet()) {
105+
def arch = architecture
104106
if (arch == "x86_64") {
105107
continue
106108
}
@@ -122,7 +124,8 @@ try { lock(resource: "bump-${params.STREAM}") { timeout(time: 120, unit: 'MINUTE
122124
// later) what packages changed.
123125
stage("Fetch Metadata") {
124126
def parallelruns = [:]
125-
for (arch in archinfo.keySet()) {
127+
for (architecture in archinfo.keySet()) {
128+
def arch = architecture
126129
parallelruns[arch] = {
127130
if (arch == "x86_64") {
128131
shwrap("""
@@ -146,7 +149,8 @@ try { lock(resource: "bump-${params.STREAM}") { timeout(time: 120, unit: 'MINUTE
146149
parallel parallelruns
147150
}
148151

149-
for (arch in archinfo.keySet()) {
152+
for (architecture in archinfo.keySet()) {
153+
def arch = architecture
150154
lockfile = "src/config/manifest-lock.${arch}.json"
151155
(pkgChecksum, pkgTimestamp) = getLockfileInfo(lockfile)
152156
archinfo[arch]['newPkgChecksum'] = pkgChecksum
@@ -187,7 +191,8 @@ try { lock(resource: "bump-${params.STREAM}") { timeout(time: 120, unit: 'MINUTE
187191
if (haveChanges) {
188192
// Run tests across all architectures in parallel
189193
def outerparallelruns = [:]
190-
for (arch in archinfo.keySet()) {
194+
for (architecture in archinfo.keySet()) {
195+
def arch = architecture
191196
outerparallelruns[arch] = {
192197
def buildAndTest = {
193198
def parallelruns = [:]
@@ -300,7 +305,8 @@ try { lock(resource: "bump-${params.STREAM}") { timeout(time: 120, unit: 'MINUTE
300305

301306
// Destroy the remote sessions. We don't need them anymore
302307
stage("Destroy Remotes") {
303-
for (arch in archinfo.keySet()) {
308+
for (architecture in archinfo.keySet()) {
309+
def arch = architecture
304310
if (arch == "x86_64") {
305311
continue
306312
}

0 commit comments

Comments
 (0)