I am trying to set up a continuous Integration Toolchain for an embedded system.
Therefore I am using jenkins (declerative pipeline) to checkout my SVN Repo and build the hexfile for the mikrocontroller. After this stage, I want to publish the hexfiles including all buildinformation (used compiler, environment variables, ...) to my artifactory server. My purpose is, that every build is stored in the artifactory server with the attached hexfile, so that I can reproduce the build also in a few years with the same compiler and the same used toolchain.
Jenkins works very well for my purpose. I am also able to push the hexfiles and the buildinformation to artefactory, but there is no connection between the buildinfo and the hexfile.
My Problem is, that I want to deploy a build from jenkins to my artefactory server, where the hexfile is attached. At the moment, I only can publish the buildinformation with all relevant informations about the build to artefactory, but the Tab, where the artefacts should be attached is empty. The hexfile itself is deployed in a seperated repo.
Can anybody help me to attach the hexfile to the buildinformation pls? Thank you in advance :)
My actual code for Deploying looks like:
stage('Deploy')
{
steps {
script {
echo 'Deploying....'
// upload the hey and json files to artefactory
rtUpload (
serverId: 'artefact_server',
spec: '''{
"files": [
{
"pattern": ".\\release\\**.hex",
"target": "generic-local"
},
{
"pattern": ".\\release\\**.json",
"target": "generic-local"
}
]
}''',
failNoOp: true
)
// collect and upload build information
def server = Artifactory.server 'artefact_server'
buildInfo = Artifactory.newBuildInfo()
buildInfo.env.capture = true
buildInfo.env.collect()
server.publishBuildInfo buildInfo
}
Thanks to the help of Muhammed, I have solved the Problem now.
I changed my script to the following code and now it works fine and the artifacts are attached to the builds in artifactory. I forgot to attach the upload specification, when creating the buildinfo. When using scipted pipeline for buildinfo and artifact upload, this can be done when creating th buildinfo object. Thank you very much.
def uploadSpec = """{
"files": [
{
"pattern": ".\\release\\**.hex",
"target": "generic-local"
},
{
"pattern": ".\\release\\**.json",
"target": "generic-local"
}
]
}"""
def server = Artifactory.server 'artefact_server'
buildInfo = server.upload spec: uploadSpec
buildInfo.env.capture = true
buildInfo.env.collect()
server.upload spec: uploadSpec
server.publishBuildInfo buildInfo