feat(ci): use s5cmd instead of obsolete s3cmd

It's actively maintained and has better concurrency support.

Depends on:
- https://github.com/status-im/status-jenkins-lib/pull/92

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2024-07-01 09:54:54 +02:00
parent 424d2d4b5c
commit 31acf51b1e
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
12 changed files with 35 additions and 16 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.12' library 'status-jenkins-lib@v1.9.1'
/* Options section can't access functions in objects. */ /* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild() def isPRBuild = utils.isPRBuild()
@ -71,7 +71,7 @@ pipeline {
} }
stage('Upload') { stage('Upload') {
steps { script { steps { script {
def urls = apks.collect { s3.uploadArtifact(it) } def urls = apks.collect { s5cmd.upload(it) }
if (urls.size() > 1) { /* Return only the universal APK. */ if (urls.size() > 1) { /* Return only the universal APK. */
env.PKG_URL = urls.find { it.contains('universal') } env.PKG_URL = urls.find { it.contains('universal') }
} else { /* If no universal is available pick first. */ } else { /* If no universal is available pick first. */

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.12' library 'status-jenkins-lib@v1.9.1'
pipeline { pipeline {
agent { label 'linux' } agent { label 'linux' }
@ -72,7 +72,7 @@ pipeline {
iOS: utils.pkgUrl(ios), iOS: utils.pkgUrl(ios),
Diawi: utils.getEnv(ios, 'DIAWI_URL'), Diawi: utils.getEnv(ios, 'DIAWI_URL'),
/* upload the sha256 checksums file too */ /* upload the sha256 checksums file too */
SHA: s3.uploadArtifact(sha), SHA: s5cmd.upload(sha),
] ]
/* add URLs to the build description */ /* add URLs to the build description */
jenkins.setBuildDesc(urls) jenkins.setBuildDesc(urls)
@ -83,7 +83,7 @@ pipeline {
steps { script { steps { script {
switch (utils.getBuildType()) { switch (utils.getBuildType()) {
case 'nightly': /* Create JSON file with newest build URLs */ case 'nightly': /* Create JSON file with newest build URLs */
s3.updateBucketJSON(urls, 'latest.json'); updateBucketJSON(urls, 'latest.json');
break; break;
case 'release': case 'release':
github.publishReleaseFiles(repo: 'status-mobile'); github.publishReleaseFiles(repo: 'status-mobile');
@ -114,3 +114,22 @@ def Boolean getPublishDefault(Boolean previousValue) {
if (previousValue != null) { return previousValue } if (previousValue != null) { return previousValue }
return false return false
} }
/* Helper for updating JSON with newest builds. */
def updateBucketJSON(urls, fileName) {
/* latest.json has slightly different key names */
def content = [
DIAWI: urls.Diawi,
APK: urls.Apk, IOS: urls.iOS,
APP: urls.App, MAC: urls.Mac,
WIN: urls.Win, SHA: urls.SHA
]
def filePath = "${pwd()}/pkg/${fileName}"
/* it might not exist */
sh "mkdir -p ${pwd()}/pkg"
def contentJson = new JsonBuilder(content).toPrettyString()
println "${filePath}:\n${contentJson}"
writeFile(file: filePath, text: contentJson)
return s5cmd.upload(filePath)
}

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.12' library 'status-jenkins-lib@v1.9.1'
pipeline { pipeline {
agent { label 'linux' } agent { label 'linux' }

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.12' library 'status-jenkins-lib@v1.9.1'
/* Options section can't access functions in objects. */ /* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild() def isPRBuild = utils.isPRBuild()

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.12' library 'status-jenkins-lib@v1.9.1'
/* Options section can't access functions in objects. */ /* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild() def isPRBuild = utils.isPRBuild()
@ -75,7 +75,7 @@ pipeline {
stage('Upload') { stage('Upload') {
steps { steps {
script { script {
env.PKG_URL = s3.uploadArtifact(LOG_FILE) env.PKG_URL = s5cmd.upload(LOG_FILE)
} }
} }
} }

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.12' library 'status-jenkins-lib@v1.9.1'
pipeline { pipeline {

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.12' library 'status-jenkins-lib@v1.9.1'
pipeline { pipeline {

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.12' library 'status-jenkins-lib@v1.9.1'
pipeline { pipeline {

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.12' library 'status-jenkins-lib@v1.9.1'
pipeline { pipeline {
agent { label 'macos' } agent { label 'macos' }

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.12' library 'status-jenkins-lib@v1.9.1'
pipeline { pipeline {
agent { label params.AGENT_LABEL } agent { label params.AGENT_LABEL }

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.12' library 'status-jenkins-lib@v1.9.1'
pipeline { pipeline {
agent { label 'linux' } agent { label 'linux' }

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.12' library 'status-jenkins-lib@v1.9.1'
pipeline { pipeline {
agent { agent {