From e08d3bd78ddf81e1027e66ac0cb04d4d2895eb99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Thu, 15 Jun 2023 09:39:28 +0200 Subject: [PATCH] ci: build generic status-go and all shells MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When discussing caching of `status-go` with Sid I noticed that the build we cache daily created from our nightly build is different from the build we create locally due to a single input. In a release CI host we can see the IPFS URL is that of Infura: ``` > find /nix/store -maxdepth 1 -name '*-status-go-*android' | tail -n1 /nix/store/2cc8ilhx5g3k2awbn4sla61n4cml2405-status-go-0.130.1-d2cce5e-android > RESULT=$(find /nix/store -maxdepth 1 -name '*-status-go-*android' | tail -n1) > nix show-derivation $RESULT | tr ' ' '\n' | grep IpfsGateway github.com/status-im/status-go/params.IpfsGatewayURL=https://status-im.infura-ipfs.io/ipfs/ ``` But for a local build the URL is the default, which is our own gateway: ``` > nix-build --no-out-link -A targets.status-go.mobile.android /nix/store/1p53m7a6y1kg3vcyd8d06scf3bsyn5rk-status-go-0.157.2-47711c4-android > RESULT=$(nix-build --no-out-link -A targets.status-go.mobile.android) > nix show-derivation $RESULT | tr ' ' '\n' | grep IpfsGateway github.com/status-im/status-go/params.IpfsGatewayURL=https://ipfs.status.im/ ``` This difference causes builds of `status-go` that get uploaded to our Nix cache to not match what developers locally would build, which results in a cache miss. This changes the Nix cache CI jobs to instead of building only dependencies (`buildInuts`) to simply build the generic versions of `status-go` without nightly specific inputs. Signed-off-by: Jakub SokoĊ‚owski --- ci/tools/Jenkinsfile.nix-cache | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/ci/tools/Jenkinsfile.nix-cache b/ci/tools/Jenkinsfile.nix-cache index 537216745f..bd7b9d2e5b 100644 --- a/ci/tools/Jenkinsfile.nix-cache +++ b/ci/tools/Jenkinsfile.nix-cache @@ -28,7 +28,7 @@ pipeline { timestamps() disableConcurrentBuilds() /* Prevent Jenkins jobs from running forever */ - timeout(time: 300, unit: 'MINUTES') + timeout(time: 120, unit: 'MINUTES') /* Limit builds retained */ buildDiscarder(logRotator( numToKeepStr: '20', @@ -41,18 +41,19 @@ pipeline { steps { script { nix.shell('nix-env -i openssh', sandbox: false, pure: false) /* some build targets don't build on MacOS */ - uname = sh(script: 'uname', returnStdout: true) + os = sh(script: 'uname', returnStdout: true) + arch = sh(script: 'arch', returnStdout: true) } } } stage('Build status-go') { steps { script { - def platforms = ['mobile.android', 'mobile.ios'] - if (uname != "Darwin") { - platforms.removeAll { it == "ios" } - } + def platforms = ['mobile.android', 'mobile.ios', 'library'] + if (os != 'Darwin') { platforms.removeAll { it == 'mobile.ios' } } + /* FIXME: Remove this when #16237 is merged. */ + if (arch == 'arm64') { platforms.removeAll { it == 'mobile.android' } } platforms.each { os -> nix.build( - attr: "targets.status-go.${os}.buildInputs", + attr: "targets.status-go.${os}", sandbox: false, link: false ) @@ -83,12 +84,16 @@ pipeline { } stage('Build nix shell deps') { steps { script { + def shells = ['android', 'ios', 'fastlane', 'keytool', 'clojure', 'gradle'] + if (os != "Darwin") { shells.removeAll { it == 'ios' } } /* Build/fetch deps required to start default Nix shell. */ - nix.build( - attr: 'shells.default.buildInputs', - sandbox: false, - link: false - ) + shells.each { shell -> + nix.build( + attr: "shells.${shell}.buildInputs", + sandbox: false, + link: false + ) + } } } } stage('Upload') {