Skip to content

Instantly share code, notes, and snippets.

@robpearson
Created January 15, 2020 00:35
Show Gist options
  • Save robpearson/0c7dd3aa72b955890a3a1ac103406c7b to your computer and use it in GitHub Desktop.
Save robpearson/0c7dd3aa72b955890a3a1ac103406c7b to your computer and use it in GitHub Desktop.
Sample Octopus Jenkins pipeline
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'dotnet publish RandomQuotes.sln --output published-app --configuration Release'
}
}
stage('Run Tests') {
steps {
sh 'dotnet test RandomQuotes.sln --logger "trx;LogFileName=TestResults.trx"'
}
}
stage('Package') {
steps {
sh "/opt/Octo/Octo pack --id RandomQuotes --version 1.6.${env.BUILD_NUMBER} --format=Zip --basePath RandomQuotes/published-app"
}
}
stage ('Push to Octopus') {
steps {
sh "/opt/Octo/Octo push --package=RandomQuotes.1.6.${env.BUILD_NUMBER}.zip --replace-existing --server=https://myinstance.octopus.app/ --space=RobP --apiKey=API-MYKEY"
}
}
stage ('Create release') {
steps {
sh "/opt/Octo/Octo create-release --project='Random Quotes' --releaseNumber 1.6.${env.BUILD_NUMBER} --server=https://myinstance.octopus.app/ --space=RobP --apiKey=API-MYKEY"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment