Skip to content

Commit

Permalink
feat(jenkins): Add optional parameters to install plugins from anothe…
Browse files Browse the repository at this point in the history
…r job

In the "dummy" stage for building the Docker image, change the command
to list the plugins, to do something more meaningful than just showing
the version.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Feb 12, 2024
1 parent e1781aa commit bd0371f
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion integrations/jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,18 @@ pipeline {
defaultValue: true
)

string(
name: 'PLUGIN_JOB_NAME',
description: 'The name of the job to copy plugins from. The distribution must be at "build/distributions/*.tar".',
defaultValue: ''
)

buildSelector(
name: 'PLUGIN_BUILD_SELECTOR',
description: 'The selector for the build of the plugin job to copy plugins from.',
defaultSelector: lastSuccessful()
)

string(
name: 'ENVIRONMENT_VARIABLES',
description: 'Optional list of comma-separated key=value pairs of environment variables to set.',
Expand Down Expand Up @@ -265,6 +277,32 @@ pipeline {

ortVersion = env.GIT_COMMIT.take(10)
}

sh '''
rm -fr cli/src/main/dist/plugin
'''.stripIndent().trim()
}
}

stage('Install plugins') {
agent any

when {
beforeAgent true

expression {
!params.PLUGIN_JOB_NAME.allWhitespace
}
}

steps {
script {
copyArtifacts(projectName: params.PLUGIN_JOB_NAME, selector: buildParameter(params.PLUGIN_BUILD_SELECTOR), filter: 'build/distributions/*.tar')
}

sh '''
tar -C cli/src/main/dist/plugin --strip-components=1 -xf build/distributions/*.tar && rm build/distributions/*.tar
'''.stripIndent().trim()
}
}

Expand Down Expand Up @@ -294,7 +332,7 @@ pipeline {
ORT_OPTIONS="$ORT_OPTIONS --stacktrace"
fi
/opt/ort/bin/ort $ORT_OPTIONS --version
/opt/ort/bin/ort $ORT_OPTIONS requirements --list plugins
'''.stripIndent().trim()
}
}
Expand Down

0 comments on commit bd0371f

Please sign in to comment.