Skip to content

Commit

Permalink
Pushing updated Jenkinsfile for blog post
Browse files Browse the repository at this point in the history
  • Loading branch information
Cory Reid committed Aug 23, 2021
1 parent eb618bc commit 88cfdcc
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
pipeline{
agent any

environment {
// Primary .csproj location
projectLocation = "RandomQuotes\\RandomQuotes.csproj"
// Default publish location
publishedPath = ".\\RandomQuotes\\bin\\Debug\\net5.0\\publish\\"
// Git location for checkout
gitUrl = "https://github.com/OctopusSamples/RandomQuotes.git"
// Branch for checkout
gitBranch = "config-as-code-walkthrough"
// ServerId from Configure System -> Octopus Deploy Plugin
octopusServerId = "NewLocal"
}

stages{

stage('Prep - Clean/Checkout'){
steps{
cleanWs deleteDirs: true
git credentialsId: 'GitHub-PAT', url: "${env.gitUrl}", branch: 'main'
}
}

stage('Dotnet - Restore/Clean/Build/Publish'){
steps{
bat "dotnet restore ${env.projectLocation}"
bat "dotnet clean ${env.projectLocation}"
bat "dotnet publish ${env.projectLocation}"
}
}

stage('Octopus'){
steps{
octopusPack additionalArgs: '', includePaths: '', outputPath: '', packageFormat: 'zip', packageId: "${JOB_NAME}", packageVersion: "${BUILD_NUMBER}", sourcePath: "${publishedPath}", toolId: 'Default', verboseLogging: true
octopusPushPackage additionalArgs: '', overwriteMode: 'FailIfExists', packagePaths: "${JOB_NAME}.${BUILD_NUMBER}.zip", serverId: "${octopusServerId}", spaceId: 'Spaces-1', toolId: 'Default'
}
}
}
}

0 comments on commit 88cfdcc

Please sign in to comment.