diff --git a/Jenkinsfile b/Jenkinsfile index 0246b464598686ea93aa8771cf298eeeb9a323de..4f53f3f9f8225e257992e0bd5c44e0a9ad9bd962 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -91,34 +91,10 @@ def buildImage(architecture, type, board, debosarguments = "", sysroot = false, } if (ostree) { - - stage("${architecture} ${type} OStree repo pull") { - sh(script: """\ - cd ${PIPELINE_VERSION}/${architecture}/${type}; \ - rm -rf repo; \ - mkdir repo; \ - ostree init --repo=repo --mode archive-z2; - ostree remote --repo=repo add --no-gpg-verify origin https://images.apertis.org/ostree/${architecture}-generic-${type}; - ostree pull --repo=repo origin apertis/${architecture}-generic/${type}""") - } - - stage("${architecture} ${type} OStree commit") { - sh(script: """\ - cd ${PIPELINE_VERSION}/${architecture}/${type}; \ - debos ${debosarguments} \ - -t architecture:${architecture} \ - -t type:$type \ - -t suite:$release \ - -t ospack:ospack_${release}-${architecture}-${type}_${PIPELINE_VERSION}.tar.gz \ - -t message:${release}-${type}-${architecture}-${board}_${PIPELINE_VERSION} \ - ${WORKSPACE}/apertis-ostree-commit.yaml; - ostree --repo=repo summary -u""") - } - - stage("${architecture} ${type} OStree upload") { - uploadDirectory("${env.PIPELINE_VERSION}/${architecture}/${type}/repo", "ostree/${architecture}-generic-${type}", production) - } - } + buildOStree(architecture, type, board, debosarguments) + /* Create ostree and ospack for container (board name = lxc) */ + buildContainer(architecture, type, "lxc", debosarguments) + } } finally { stage("Cleanup ${architecture} ${type}") { @@ -131,6 +107,60 @@ def buildImage(architecture, type, board, debosarguments = "", sysroot = false, } } +def buildOStree(architecture, type, board, debosarguments = "") { + stage("${architecture} ${type} ${board} OStree repo pull") { + sh(script: """\ + cd ${PIPELINE_VERSION}/${architecture}/${type}; \ + rm -rf repo; \ + mkdir repo; \ + ostree init --repo=repo --mode archive-z2; + ostree remote --repo=repo add --no-gpg-verify origin https://images.apertis.org/ostree/${architecture}-${board}-${type}; + ostree pull --repo=repo origin apertis/${architecture}-${board}/${type}""") + } + + stage("${architecture} ${type} ${board} OStree commit") { + sh(script: """\ + cd ${PIPELINE_VERSION}/${architecture}/${type}; \ + debos ${debosarguments} \ + -t architecture:${architecture} \ + -t type:$type \ + -t suite:$release \ + -t ospack:ospack_${release}-${architecture}-${type}_${PIPELINE_VERSION}.tar.gz \ + -t message:${release}-${type}-${architecture}-${board}_${PIPELINE_VERSION} \ + ${WORKSPACE}/apertis-ostree-commit.yaml; + ostree --repo=repo summary -u""") + } + + stage("${architecture} ${type} ${board} OStree upload") { + uploadDirectory("${env.PIPELINE_VERSION}/${architecture}/${type}/repo/", "ostree/${architecture}-${board}-${type}", production) + } + +} + +def buildContainer(architecture, type, board, debosarguments = "") { + + buildOStree(architecture, type, board, debosarguments) + + stage("${architecture} ${type} ${board} OStree pack") { + sh(script: """\ + cd ${PIPELINE_VERSION}/${architecture}/${type}; \ + debos ${debosarguments} \ + -t architecture:${architecture} \ + -t type:$type \ + -t suite:$release \ + -t repourl:https://images.apertis.org/ostree/${architecture}-generic-${type} \ + -t osname:apertis \ + -t branch:apertis/${architecture}-generic/${type} \ + -t ospack:lxc-ostree-${release}-${architecture}-${type}_${PIPELINE_VERSION}.tar.gz \ + -t message:${release}-${type}-${architecture}-${type}-${board}_${PIPELINE_VERSION} \ + ${WORKSPACE}/apertis-ostree-pack.yaml""") + } + + stage("${architecture} ${type} ${board} OStree upload") { + uploadDirectory ("${PIPELINE_VERSION}/${architecture}/${type}/lxc-ostree-${release}-${architecture}-${type}_${PIPELINE_VERSION}.tar.gz", + "lxc/${release}/${PIPELINE_VERSION}", production) + } +} /* Determine whether to run uploads based on the prefix of the job name; in * case of apertis we expect the official jobs under apertis-<release>/ while @@ -143,7 +173,7 @@ images["Sdk"] = buildImage("amd64", "sdk", "sdk", "--scratchsize 10G", false, false, production) -// Types for all boards, common debos arguments, sysroots and +// Types for all boards, common debos arguments, sysroots and ospacks def types = [ [ "minimal", "", false, true], [ "target", "", false, true], [ "development", "--scratchsize 10G", true, false]