mirror of
https://github.com/AmigaPorts/docker-amiga-gcc.git
synced 2025-11-19 16:22:32 +00:00
Fix multi-arch builds
This commit is contained in:
@ -1,7 +1,8 @@
|
||||
ARG BUILD_OS
|
||||
ARG BUILD_PFX
|
||||
|
||||
FROM amigadev/${BUILD_PFX}:latest as build-env
|
||||
FROM --platform=$TARGETPLATFORM amigadev/${BUILD_PFX}:latest as build-env
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
FROM amigadev/docker-base:latest
|
||||
|
||||
|
||||
@ -6,7 +6,11 @@
|
||||
"DockerTag": "m68k-amigaos",
|
||||
"Prefix": "",
|
||||
"Dockerfile": "Dockerfile",
|
||||
"BuildIfSuccessful": "",
|
||||
"Platforms": [
|
||||
"amd64",
|
||||
"arm64"
|
||||
],
|
||||
"BuildIfSuccessful": [],
|
||||
"BuildParam": "AmigaOS"
|
||||
},
|
||||
{
|
||||
@ -15,7 +19,10 @@
|
||||
"DockerTag": "m68k-amigaos-gcc10",
|
||||
"Prefix": "m68k-amigaos",
|
||||
"Dockerfile": "Dockerfile",
|
||||
"BuildIfSuccessful": "",
|
||||
"Platforms": [
|
||||
"amd64"
|
||||
],
|
||||
"BuildIfSuccessful": [],
|
||||
"BuildParam": "AmigaOS"
|
||||
},
|
||||
{
|
||||
@ -24,7 +31,10 @@
|
||||
"DockerTag": "ppc-amigaos",
|
||||
"Prefix": "",
|
||||
"Dockerfile": "Dockerfile",
|
||||
"BuildIfSuccessful": "",
|
||||
"Platforms": [
|
||||
"amd64"
|
||||
],
|
||||
"BuildIfSuccessful": [],
|
||||
"BuildParam": "AmigaOS"
|
||||
|
||||
},
|
||||
@ -34,7 +44,10 @@
|
||||
"DockerTag": "ppc-morphos",
|
||||
"Prefix": "",
|
||||
"Dockerfile": "Dockerfile",
|
||||
"BuildIfSuccessful": "",
|
||||
"Platforms": [
|
||||
"amd64"
|
||||
],
|
||||
"BuildIfSuccessful": [],
|
||||
"BuildParam": "MorphOS"
|
||||
|
||||
}
|
||||
|
||||
86
Jenkinsfile
vendored
86
Jenkinsfile
vendored
@ -70,18 +70,83 @@ def buildStep(DOCKER_ROOT, DOCKERIMAGE, DOCKERTAG, DOCKERFILE, BUILD_NEXT, BUILD
|
||||
customImage.push();
|
||||
}
|
||||
}
|
||||
|
||||
if (!BUILD_NEXT.equals('')) {
|
||||
build "${BUILD_NEXT}/${env.BRANCH_NAME}";
|
||||
}
|
||||
} catch(err) {
|
||||
//slackSend color: "danger", channel: "#jenkins", message: "Build Failed: ${fixed_job_name} #${env.BUILD_NUMBER} Target: ${DOCKER_ROOT}/${DOCKERIMAGE}:${DOCKERTAG} (<${env.BUILD_URL}|Open>)"
|
||||
currentBuild.result = 'FAILURE'
|
||||
notify("Build Failed: ${fixed_job_name} #${env.BUILD_NUMBER} Target: ${DOCKER_ROOT}/${DOCKERIMAGE}:${DOCKERTAG}")
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
def buildManifest(DOCKER_ROOT, DOCKERIMAGE, DOCKERTAG, DOCKERFILE, PLATFORMS, BUILD_NEXT) {
|
||||
def fixed_job_name = env.JOB_NAME.replace('%2F','/')
|
||||
try {
|
||||
checkout scm;
|
||||
|
||||
def buildenv = '';
|
||||
def tag = '';
|
||||
if (env.BRANCH_NAME.equals('master')) {
|
||||
buildenv = 'production';
|
||||
tag = "${DOCKERTAG}";
|
||||
} else if (env.BRANCH_NAME.equals('dev')) {
|
||||
buildenv = 'development';
|
||||
tag = "${DOCKERTAG}-dev";
|
||||
} else {
|
||||
throw new Exception("Invalid branch, stopping build!");
|
||||
}
|
||||
|
||||
docker.withRegistry("https://index.docker.io/v1/", "dockerhub") {
|
||||
stage("Building ${DOCKERIMAGE}:${tag} manifest...") {
|
||||
sh('docker version');
|
||||
def platformsString = "";
|
||||
PLATFORMS.each { p ->
|
||||
sh("docker pull ${DOCKER_ROOT}/${DOCKERIMAGE}:${tag}_${p}");
|
||||
platformsString = "${platformsString} ${DOCKER_ROOT}/${DOCKERIMAGE}:${tag}_${p}"
|
||||
}
|
||||
|
||||
sh("docker manifest create ${DOCKER_ROOT}/${DOCKERIMAGE}:${tag} ${platformsString}");
|
||||
sh("docker manifest push ${DOCKER_ROOT}/${DOCKERIMAGE}:${tag}");
|
||||
}
|
||||
}
|
||||
|
||||
def branches = [:]
|
||||
|
||||
BUILD_NEXT.each { v ->
|
||||
branches["Build ${v}"] = {
|
||||
build "${v}/${env.BRANCH_NAME}";
|
||||
}
|
||||
}
|
||||
|
||||
parallel branches;
|
||||
} catch(err) {
|
||||
slackSend color: "danger", channel: "#jenkins", message: "Build Failed: ${fixed_job_name} #${env.BUILD_NUMBER} Target: ${DOCKER_ROOT}/${DOCKERIMAGE}:${tag} (<${env.BUILD_URL}|Open>)"
|
||||
currentBuild.result = 'FAILURE'
|
||||
notify("Build Failed: ${fixed_job_name} #${env.BUILD_NUMBER} Target: ${DOCKER_ROOT}/${DOCKERIMAGE}:${tag}")
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
def steps(v) {
|
||||
def platforms = [:];
|
||||
|
||||
v.Platforms.each { p ->
|
||||
platforms["Build ${v.DockerRoot}/${v.DockerImage}:${v.DockerTag}_${p}"] = {
|
||||
stage("Build ${p} version") {
|
||||
node(p) {
|
||||
buildStep(v.DockerRoot, v.DockerImage, "${v.DockerTag}_${p}", v.Dockerfile, [], v.BuildParam)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
parallel platforms;
|
||||
|
||||
stage('Build multi-arch manifest') {
|
||||
node() {
|
||||
buildManifest(v.DockerRoot, v.DockerImage, v.DockerTag, v.Dockerfile, v.Platforms, v.BuildIfSuccessful)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
properties([[$class: 'ParametersDefinitionProperty', parameterDefinitions: [[$class: 'StringParameterDefinition', name: 'BUILD_IMAGE', defaultValue: 'all']]]])
|
||||
|
||||
node('master') {
|
||||
@ -91,7 +156,6 @@ node('master') {
|
||||
}
|
||||
|
||||
def fixed_job_name = env.JOB_NAME.replace('%2F','/');
|
||||
//slackSend color: "good", channel: "#jenkins", message: "Build Started: ${fixed_job_name} #${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)";
|
||||
|
||||
checkout scm;
|
||||
|
||||
@ -101,9 +165,7 @@ node('master') {
|
||||
if (BUILD_IMAGE.equals('all')) {
|
||||
project.builds.each { v ->
|
||||
branches["Build ${v.DockerRoot}/${v.DockerImage}:${v.DockerTag}"] = {
|
||||
node {
|
||||
buildStep(v.DockerRoot, v.DockerImage, v.DockerTag, v.Dockerfile, v.BuildIfSuccessful, v.BuildParam, v.Prefix);
|
||||
}
|
||||
steps(v);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -111,15 +173,13 @@ node('master') {
|
||||
project.builds.each { v ->
|
||||
if ("${v.DockerTag}".equals("${BUILD_IMAGE}")) {
|
||||
branches["Build ${v.DockerRoot}/${v.DockerImage}:${v.DockerTag}"] = {
|
||||
node {
|
||||
buildStep(v.DockerRoot, v.DockerImage, v.DockerTag, v.Dockerfile, v.BuildIfSuccessful, v.BuildParam, v.Prefix);
|
||||
}
|
||||
steps(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sh "rm -rf ./*"
|
||||
sh "rm -rf ./*";
|
||||
|
||||
parallel branches;
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ cd "${SUBMODULES}"
|
||||
|
||||
# SDL1.2
|
||||
if [ ! -d "${SUBMODULES}/SDL" ]; then
|
||||
git clone https://github.com/AmigaPorts/SDL.git "${SUBMODULES}"/SDL
|
||||
git clone https://github.com/AmigaPorts/SDL_old.git "${SUBMODULES}"/SDL
|
||||
fi
|
||||
cd "${SUBMODULES}"/SDL
|
||||
git checkout SDL-1.2-AmigaOS3
|
||||
|
||||
@ -24,7 +24,7 @@ cd "${SUBMODULES}"
|
||||
|
||||
# SDL1.2
|
||||
if [ ! -d "${SUBMODULES}/SDL" ]; then
|
||||
git clone https://github.com/AmigaPorts/SDL.git "${SUBMODULES}"/SDL
|
||||
git clone https://github.com/AmigaPorts/SDL_old.git "${SUBMODULES}"/SDL
|
||||
fi
|
||||
cd "${SUBMODULES}"/SDL
|
||||
git checkout SDL-1.2-AmigaOS3
|
||||
|
||||
Reference in New Issue
Block a user