Skip to content

Commit

Permalink
Multi arch build and deploy update in jenkins file and docker file-test
Browse files Browse the repository at this point in the history
  • Loading branch information
abhidwivedi2701 committed Aug 8, 2024
1 parent 6bc768d commit 5d256ab
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM flowdocker/play_builder:latest-java17 as builder
FROM flowdocker/play_builder:latest-java17-jammy as builder
ADD . /opt/play
WORKDIR /opt/play
RUN SBT_OPTS="-Xms1024M -Xmx2048M -Xss2M -XX:MaxMetaspaceSize=2048M" sbt clean stage
Expand Down
119 changes: 89 additions & 30 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,95 @@ pipeline {
}
}
}
stage("All in parallel") {
parallel {

stage("Build, Deploy, SBT test") {
stages {
stage('Build and deploy') {
// when { branch 'main' }
stages {
stage('Build and push docker image release') {
stages {
stage("parallel image builds") {
parallel {
stage("Build x86_64/amd64 registry image") {
steps {
container('kaniko') {
script {
String semversion = VERSION.printable()
imageBuild(
orgName: 'flowcommerce',
serviceName: 'registry',
platform: 'amd64',
dockerfilePath: '/Dockerfile',
// semver: semversion
semver: 'test'
)
}
}
}
}
stage("Build arm64 registry image") {
agent {
kubernetes {
label 'registry-arm64'
inheritFrom 'kaniko-slim-arm64'
}
}
steps {
container('kaniko') {
script {
String semversion = VERSION.printable()
imageBuild(
orgName: 'flowcommerce',
serviceName: 'registry',
platform: 'arm64',
dockerfilePath: '/Dockerfile',
// semver: semversion
semver: 'test'
)
}
}
}
}
}
}
}
}
stage('manifest tool step for registry docker images') {
steps {
container('kaniko') {
script {
// semver = VERSION.printable()
semver = VERSION.printable()
String templateName = "registry-ARCH:${semver}"
String targetName = "registry:${semver}"
String orgName = "flowcommerce"
String jenkinsAgentArch = "amd64"
manifestTool(templateName, targetName, orgName, jenkinsAgentArch)
}
}
}
}
stage('Deploy service') {
when { branch 'main' }
stages {
stage("parallel service Deploy") {
parallel {
stage('Deploy registry') {
steps {
script {
container('helm') {
new helmCommonDeploy().deploy('registry', 'production', VERSION.printable())
}
}
}
}
}
}
}
}
}
}
stage('SBT Test') {
steps {
container('play') {
Expand All @@ -81,34 +168,6 @@ pipeline {
}
}
}
stage('build and deploy registry') {
when { branch 'main' }
stages {
stage('Build and push docker image release') {
steps {
container('kaniko') {
script {
semver = VERSION.printable()
sh """
/kaniko/executor -f `pwd`/Dockerfile -c `pwd` \
--snapshot-mode=redo --use-new-run \
--destination ${env.ORG}/registry:$semver
"""
}
}
}
}
stage('deploy registry') {
steps {
script {
container('helm') {
new helmCommonDeploy().deploy('registry', 'production', VERSION.printable())
}
}
}
}
}
}
}
}
}
Expand Down

0 comments on commit 5d256ab

Please sign in to comment.