Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docker): multiplatforms builds #715

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6d93ded
multiplatforms builds
smerleCB Aug 2, 2023
ef9b15f
getime bug
smerleCB Aug 2, 2023
b4c4ac6
correct unit test
smerleCB Aug 3, 2023
b676dd3
spotless clean
smerleCB Aug 3, 2023
7d8b02f
add platform to hadolint id to avoid concurrence
smerleCB Aug 3, 2023
0a569e1
correct unit test with platform and replace slash from hadolintReportId
smerleCB Aug 3, 2023
16244f5
add amend part for multiplatform builds
smerleCB Aug 3, 2023
d012c86
chore
smerleCB Aug 4, 2023
853b9db
distinguish defaultImageName and ImageName for tags and image naming
smerleCB Aug 4, 2023
0c84660
remove test name specific
smerleCB Aug 4, 2023
c7a33a5
add a node for last stage, and remove git tag creation on multiplatfo…
smerleCB Aug 4, 2023
c7459d1
temporary disable tag test for multiplatforms
smerleCB Aug 4, 2023
459b9a7
chore
smerleCB Aug 4, 2023
34a5c4a
remove old remnants from test
smerleCB Aug 4, 2023
cc85bec
chore script string
smerleCB Aug 4, 2023
ad17701
chore script string
smerleCB Aug 4, 2023
63b413a
uncomment tag check
smerleCB Aug 4, 2023
0d8e70e
add nextVersion tag in git for multiplatform
smerleCB Aug 4, 2023
a4f7460
add checkout for new nodes for final stage
smerle33 Aug 7, 2023
555040b
env variablesé
smerle33 Aug 7, 2023
00f3ad3
spotless lint mvn spotless:apply
smerle33 Aug 7, 2023
2236339
encapsulation
smerle33 Aug 7, 2023
1c25f3a
test sh command
smerle33 Aug 7, 2023
6906eaf
test
smerle33 Aug 7, 2023
ef5ed81
test
smerle33 Aug 7, 2023
0ed12d7
parallel stages
smerle33 Aug 7, 2023
3f204df
chore
smerle33 Aug 7, 2023
8843696
imagename use env variable for loop
smerle33 Aug 7, 2023
8fcd9d7
groovy ImageName vs environement shell IMAGE_NAME
smerle33 Aug 10, 2023
873f2a0
add a node for multiplatform task
smerle33 Aug 10, 2023
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
34 changes: 34 additions & 0 deletions test/groovy/BuildDockerAndPublishImageStepTests.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -562,4 +562,38 @@ class BuildDockerAndPublishImageStepTests extends BaseTest {
// And all mocked/stubbed methods have to be called
verifyMocks()
}

@Test
void itBuildsAndDeploysWithPlatformsSpecificOnPrincipalBranch() throws Exception {
def script = loadScript(scriptName)
mockPrincipalBranch()
withMocks{
script.call(testImageName, [
dockerfile: 'build.Dockerfile',
imageDir: 'docker/',
platforms: ['linux/amd64', 'linux/arm64'],
automaticSemanticVersioning: true,
gitCredentials: 'git-creds',
registryNamespace: 'jenkins',
])
}
final String expectedImageName = 'jenkins/' + testImageName
printCallStack()
// Then we expect a successful build with the code cloned
assertJobStatusSuccess()
// With the common workflow run as expected
assertTrue(assertBaseWorkflow())
assertTrue(assertMethodCallContainsPattern('node', 'docker'))
// And the environement variables set with the custom configuration values
assertTrue(assertMethodCallContainsPattern('withEnv', 'IMAGE_DIR=docker/'))
assertTrue(assertMethodCallContainsPattern('withEnv', 'IMAGE_DOCKERFILE=build.Dockerfile'))
assertTrue(assertMethodCallContainsPattern('withEnv', 'IMAGE_PLATFORM=linux/amd64'))
assertTrue(assertMethodCallContainsPattern('withEnv', 'IMAGE_PLATFORM=linux/arm64'))
assertTrue(assertMethodCallContainsPattern('withEnv', 'IMAGE_NAME=' + expectedImageName))
// But no tag and no deploy called (branch or PR)
assertTrue(assertMakeDeploy(expectedImageName))
assertTrue(assertTagPushed(defaultGitTag))
// And all mocked/stubbed methods have to be called
verifyMocks()
}
}
Loading