Jenkins
In the pipeline responsible for creating your app build, edit the existing Jenkinsfile. You will add a new stage to the existing pipeline that handles the upload process. Below is an example of how you can do this:
pipeline {
agent any
// New environment variables for the Upload Stage
environment {
ORG_KEY = '<ORG_KEY>'
PLATFORM = '<platform>'
}
stages {
// Existing checkout steps
stage('Checkout') {
steps {
...
}
}
// Existing build commands
stage('Build') {
steps {
script {
...
}
}
}
// New Upload Stage
stage('Upload Build to GPT Driver') {
steps {
script {
def buildFilePath = 'path/to/your/build/file'
def response = httpRequest httpMode: 'POST',
url: 'https://api.mobileboost.io/uploadBuild/',
contentType: 'MULTIPART_FORMDATA',
multipartNameValue: [
[name: 'build', fileName: buildFilePath, mimeType: 'application/octet-stream'],
[name: 'organisation_key', value: ORG_KEY],
[name: 'platform', value: PLATFORM],
[name: 'metadata', value: '{}']
]
def responseBody = response.content
def buildId = sh(script: "echo '${responseBody}' | jq -r '.buildId'", returnStdout: true).trim()
env.BUILD_ID = buildId
echo "Build ID: ${buildId}"
}
}
}
}
post {
always {
echo "Build and upload completed"
}
}
}
Last updated