From afc241251449c5ba33f45157dd9fdead25487d62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Wed, 16 Oct 2019 08:23:53 +0200 Subject: [PATCH] desktop builds need GnuPG MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- ci/Jenkinsfile.android | 2 +- ci/Jenkinsfile.combined | 2 +- ci/Jenkinsfile.ios | 2 +- ci/Jenkinsfile.linux | 2 +- ci/Jenkinsfile.macos | 2 +- ci/Jenkinsfile.windows | 2 +- ci/common.groovy | 34 +++++++++++++++++++++++++++++++++- ci/nix.groovy | 4 ++-- ci/utils.groovy | 33 --------------------------------- nix/desktop/default.nix | 2 +- nix/desktop/macos/default.nix | 3 ++- shell.nix | 1 + 12 files changed, 45 insertions(+), 44 deletions(-) diff --git a/ci/Jenkinsfile.android b/ci/Jenkinsfile.android index 0178822a2b..990432fb3b 100644 --- a/ci/Jenkinsfile.android +++ b/ci/Jenkinsfile.android @@ -104,7 +104,7 @@ pipeline { stage('Upload') { steps { script { - def urls = apks.collect { cmn.utils.uploadArtifact(it) } + def urls = apks.collect { cmn.uploadArtifact(it) } /* return only the universal APK */ if (urls.size() > 1) { env.PKG_URL = urls.find { it.contains('universal') } diff --git a/ci/Jenkinsfile.combined b/ci/Jenkinsfile.combined index 02bbc28771..dd920a08ae 100644 --- a/ci/Jenkinsfile.combined +++ b/ci/Jenkinsfile.combined @@ -80,7 +80,7 @@ pipeline { /* desktop */ App: cmn.pkgUrl(nix), Mac: cmn.pkgUrl(osx), Win: cmn.pkgUrl(win), /* upload the sha256 checksums file too */ - SHA: cmn.utils.uploadArtifact(cmn.utils.pkgFind('sha256')), + SHA: cmn.uploadArtifact(cmn.utils.pkgFind('sha256')), ] /* add URLs to the build description */ cmn.ci.setBuildDesc(urls) diff --git a/ci/Jenkinsfile.ios b/ci/Jenkinsfile.ios index bd961c258e..fb2ba9e591 100644 --- a/ci/Jenkinsfile.ios +++ b/ci/Jenkinsfile.ios @@ -85,7 +85,7 @@ pipeline { stage('Upload') { steps { script { - env.PKG_URL = cmn.utils.uploadArtifact(api) + env.PKG_URL = cmn.uploadArtifact(api) /* e2e builds get tested in SauceLabs */ if (btype == 'e2e') { env.SAUCE_URL = ios.uploadToSauceLabs() diff --git a/ci/Jenkinsfile.linux b/ci/Jenkinsfile.linux index 88082f1904..e1d4a4bdc0 100644 --- a/ci/Jenkinsfile.linux +++ b/ci/Jenkinsfile.linux @@ -93,7 +93,7 @@ pipeline { } stage('Upload') { steps { - script { env.PKG_URL = cmn.utils.uploadArtifact(app) } + script { env.PKG_URL = cmn.uploadArtifact(app) } } } stage('Cleanup') { diff --git a/ci/Jenkinsfile.macos b/ci/Jenkinsfile.macos index d1e2dc6957..f28a035784 100644 --- a/ci/Jenkinsfile.macos +++ b/ci/Jenkinsfile.macos @@ -90,7 +90,7 @@ pipeline { } stage('Upload') { steps { - script { env.PKG_URL = cmn.utils.uploadArtifact(dmg) } + script { env.PKG_URL = cmn.uploadArtifact(dmg) } } } stage('Cleanup') { diff --git a/ci/Jenkinsfile.windows b/ci/Jenkinsfile.windows index 5a6b6ef2d6..4cfa104153 100644 --- a/ci/Jenkinsfile.windows +++ b/ci/Jenkinsfile.windows @@ -96,7 +96,7 @@ pipeline { } stage('Upload') { steps { - script { env.PKG_URL = cmn.utils.uploadArtifact(app) } + script { env.PKG_URL = cmn.uploadArtifact(app) } } } stage('Cleanup') { diff --git a/ci/common.groovy b/ci/common.groovy index cf5ddcf7de..f222d1d2f3 100644 --- a/ci/common.groovy +++ b/ci/common.groovy @@ -26,7 +26,7 @@ def updateBucketJSON(urls, fileName) { def contentJson = new JsonBuilder(content).toPrettyString() println "${fileName}:\n${contentJson}" new File(filePath).write(contentJson) - return utils.uploadArtifact(filePath) + return uploadArtifact(filePath) } def prep(type = 'nightly') { @@ -67,4 +67,36 @@ def prep(type = 'nightly') { } } +def uploadArtifact(path) { + /* defaults for upload */ + def domain = 'ams3.digitaloceanspaces.com' + def bucket = 'status-im' + /* There's so many PR builds we need a separate bucket */ + if (utils.getBuildType() == 'pr') { + bucket = 'status-im-prs' + } + /* WARNING: s3cmd can't guess APK MIME content-type */ + def customOpts = '' + if (path.endsWith('apk')) { + customOpts += "--mime-type='application/vnd.android.package-archive'" + } + /* We also need credentials for the upload */ + withCredentials([usernamePassword( + credentialsId: 'digital-ocean-access-keys', + usernameVariable: 'DO_ACCESS_KEY', + passwordVariable: 'DO_SECRET_KEY' + )]) { + nix.shell(""" + s3cmd \\ + --acl-public ${customOpts} \\ + --host="${domain}" \\ + --host-bucket="%(bucket)s.${domain}" \\ + --access_key=${DO_ACCESS_KEY} \\ + --secret_key=${DO_SECRET_KEY} \\ + put ${path} s3://${bucket}/ + """, pure: false) + } + return "https://${bucket}.${domain}/${utils.getFilename(path)}" +} + return this diff --git a/ci/nix.groovy b/ci/nix.groovy index 39fa361314..e34a7ba800 100644 --- a/ci/nix.groovy +++ b/ci/nix.groovy @@ -12,9 +12,9 @@ def shell(Map opts = [:], String cmd) { ] /* merge defaults with received opts */ opts = defaults + opts - /* Previous merge overwrites the array */ + /* previous merge overwrites the array */ opts.keep = (opts.keep + defaults.keep).unique() - + /* not all targets can use a pure build */ if (env.TARGET_OS in ['windows', 'ios']) { opts.pure = false } diff --git a/ci/utils.groovy b/ci/utils.groovy index 37fe1a1ba1..52731e3835 100644 --- a/ci/utils.groovy +++ b/ci/utils.groovy @@ -100,39 +100,6 @@ def pkgFind(glob) { return found[0].path } -def uploadArtifact(path) { - /* defaults for upload */ - def domain = 'ams3.digitaloceanspaces.com' - def bucket = 'status-im' - /* There's so many PR builds we need a separate bucket */ - if (getBuildType() == 'pr') { - bucket = 'status-im-prs' - } - /* WARNING: s3cmd can't guess APK MIME content-type */ - def customOpts = '' - if (path.endsWith('apk')) { - customOpts += "--mime-type='application/vnd.android.package-archive'" - } - /* We also need credentials for the upload */ - withCredentials([usernamePassword( - credentialsId: 'digital-ocean-access-keys', - usernameVariable: 'DO_ACCESS_KEY', - passwordVariable: 'DO_SECRET_KEY' - )]) { - sh """ - s3cmd \\ - --acl-public \\ - ${customOpts} \\ - --host='${domain}' \\ - --host-bucket='%(bucket)s.${domain}' \\ - --access_key=${DO_ACCESS_KEY} \\ - --secret_key=${DO_SECRET_KEY} \\ - put ${path} s3://${bucket}/ - """ - } - return "https://${bucket}.${domain}/${getFilename(path)}" -} - def getBuildType() { def jobName = env.JOB_NAME if (jobName.contains('e2e')) { diff --git a/nix/desktop/default.nix b/nix/desktop/default.nix index 738eea440e..58342c3807 100644 --- a/nix/desktop/default.nix +++ b/nix/desktop/default.nix @@ -8,7 +8,7 @@ let platform = callPackage ../platform.nix { inherit target-os; }; baseImageFactory = callPackage ./base-image { inherit stdenv; }; linuxPlatform = callPackage ./linux { inherit stdenv status-go baseImageFactory; }; - darwinPlatform = callPackage ./macos { inherit stdenv status-go darwin baseImageFactory; }; + darwinPlatform = callPackage ./macos { inherit stdenv status-go darwin baseImageFactory pkgs; }; windowsPlatform = callPackage ./windows { inherit stdenv go baseImageFactory; }; snoreNotifySources = callPackage ./cmake/snorenotify { }; qtkeychainSources = callPackage ./cmake/qtkeychain { }; diff --git a/nix/desktop/macos/default.nix b/nix/desktop/macos/default.nix index 8d21cc8fbe..2ee9c73a8b 100644 --- a/nix/desktop/macos/default.nix +++ b/nix/desktop/macos/default.nix @@ -1,4 +1,4 @@ -{ stdenv, callPackage, +{ stdenv, callPackage, pkgs, darwin, qt5, status-go, baseImageFactory }: with darwin.apple_sdk.frameworks; @@ -11,6 +11,7 @@ let in { buildInputs = [ + pkgs.gnupg22 baseImage qt5.full AppKit diff --git a/shell.nix b/shell.nix index 64ab4f74c2..36ad75c7b6 100644 --- a/shell.nix +++ b/shell.nix @@ -25,6 +25,7 @@ let gnumake jq wget + s3cmd ]; in mkShell {