Updated Jenkinsfile
Some checks failed
Gitea Organization/fileserver/pipeline/head There was a failure building this commit

This commit is contained in:
Mutzi 2023-02-13 01:30:22 +01:00
parent 8066c77eb4
commit 3838a55be6

57
Jenkinsfile vendored
View File

@ -41,7 +41,10 @@ pipeline {
} }
} }
stage('Package') { stage('Package') {
agent { docker { image 'alpine:latest' reuseNode true }} agent { docker {
image 'alpine:latest'
reuseNode true
}}
steps { steps {
sh 'apk add tar xz' sh 'apk add tar xz'
dir('static') { dir('static') {
@ -55,36 +58,38 @@ pipeline {
} }
} }
stage('Release') { stage('Release') {
agent { docker { image 'alpine:latest' reuseNode true }} agent any
when { buildingTag() } when { buildingTag() }
environment { environment {
TOKEN = credentials('abd7020c-43d6-485b-ae09-2f9b484d9c15') TOKEN = credentials('abd7020c-43d6-485b-ae09-2f9b484d9c15')
} }
steps { steps {
def release_body = [ script {
'name': "Version ${TAG_NAME}", def release_body = [
'tag_name': "${TAG_NAME}", 'name': "Version ${TAG_NAME}",
'is_draft': false, 'tag_name': "${TAG_NAME}",
'is_prerelease': false 'is_draft': false,
] 'is_prerelease': false
def release_body_str = writeJSON returnText: true, data: release_body ]
def release_resp = httpRequest 'https://gitea.mattv.de/api/v1/repos/root/fileserver/releases', def release_body_str = writeJSON returnText: true, data: release_body
acceptType: 'APPLICATION_JSON', def release_resp = httpRequest 'https://gitea.mattv.de/api/v1/repos/root/fileserver/releases',
contentType: 'APPLICATION_JSON', acceptType: 'APPLICATION_JSON',
customHeaders: [[name: 'Authorization', value: 'token ${TOKEN_PSW}', maskValue: true]], contentType: 'APPLICATION_JSON',
httpMode: 'POST', customHeaders: [[name: 'Authorization', value: 'token ${TOKEN_PSW}', maskValue: true]],
requestBody: release_body_str httpMode: 'POST',
def release_json = readJson text: release_resp.content requestBody: release_body_str
httpRequest 'https://gitea.mattv.de/api/v1/repos/root/fileserver/releases/${release_json.id}/assets?name=linux-x64-glibc.tar.xz', def release_json = readJson text: release_resp.content
httpMode: 'POST', httpRequest 'https://gitea.mattv.de/api/v1/repos/root/fileserver/releases/${release_json.id}/assets?name=linux-x64-glibc.tar.xz',
acceptType: 'APPLICATION_JSON', httpMode: 'POST',
customHeaders: [[name: 'Authorization', value: 'token ${TOKEN_PSW}', maskValue: true]], acceptType: 'APPLICATION_JSON',
formData: [[contentType: 'application/octet-stream', name: 'attachment', fileName: 'linux-x64-glibc.tar.xz', uploadFile: 'linux-x64-glibc.tar.xz']] customHeaders: [[name: 'Authorization', value: 'token ${TOKEN_PSW}', maskValue: true]],
httpRequest 'https://gitea.mattv.de/api/v1/repos/root/fileserver/releases/${release_json.id}/assets?name=linux-x64-muslc.tar.xz', formData: [[contentType: 'application/octet-stream', name: 'attachment', fileName: 'linux-x64-glibc.tar.xz', uploadFile: 'linux-x64-glibc.tar.xz']]
httpMode: 'POST', httpRequest 'https://gitea.mattv.de/api/v1/repos/root/fileserver/releases/${release_json.id}/assets?name=linux-x64-muslc.tar.xz',
acceptType: 'APPLICATION_JSON', httpMode: 'POST',
customHeaders: [[name: 'Authorization', value: 'token ${TOKEN_PSW}', maskValue: true]], acceptType: 'APPLICATION_JSON',
formData: [[contentType: 'application/octet-stream', name: 'attachment', fileName: 'linux-x64-muslc.tar.xz', uploadFile: 'linux-x64-muslc.tar.xz']] customHeaders: [[name: 'Authorization', value: 'token ${TOKEN_PSW}', maskValue: true]],
formData: [[contentType: 'application/octet-stream', name: 'attachment', fileName: 'linux-x64-muslc.tar.xz', uploadFile: 'linux-x64-muslc.tar.xz']]
}
} }
} }
} }