-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
71 lines (52 loc) · 2.52 KB
/
Jenkinsfile
File metadata and controls
71 lines (52 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env groovy
node {
checkout scm
def server = Artifactory.server('artifactory')
def artifactoryMaven = Artifactory.newMavenBuild()
artifactoryMaven.tool = 'M3' // Tool name from Jenkins configuration
artifactoryMaven.deployer releaseRepo:'libs-release-local', snapshotRepo:'libs-snapshot-local', server: server
artifactoryMaven.resolver releaseRepo:'libs-release', snapshotRepo:'libs-snapshot', server: server
def buildInfo = Artifactory.newBuildInfo()
pom = readMavenPom file: 'pom.xml'
env.POM_VERSION = "${pom.version}"
sh "sed -i \"s|snapshot_version|${pom.version}|g\" data/common.yaml"
stage('Package') {
// Run Maven:
def buildInfoInstall
withSonarQubeEnv('Sonatype Server') {
// requires SonarQube Scanner for Maven 3.2+
buildInfoInstall = artifactoryMaven.run pom: 'pom.xml', goals: 'clean install spring-boot:repackage'
}
buildInfo.append(buildInfoInstall)
// Publish the build-info to Artifactory:
server.publishBuildInfo buildInfo
}
stage("Sonatype Check") {
nexusPolicyEvaluation failBuildOnNetworkError: false, iqApplication: selectedApplication('sandbox-application'), iqStage: 'build', jobCredentialsId: ''
}
//
// timeout(time: 10, unit: 'MINUTES') { // Just in case something goes wrong, pipeline will be killed after a timeout
// def qg = waitForQualityGate() // Reuse taskId previously collected by withSonarQubeEnv
//
// if (qg.status != 'OK') {
// error "Pipeline aborted due to quality gate failure: ${qg.status}"
// }
// }
// }
stage('Build Container') {
docker.withRegistry('https://docker.fs.usda.gov', 'docker_registry') {
def image = docker.build("docker.fs.usda.gov/ead/boss_api_development:${env.BUILD_NUMBER}", '--no-cache --pull .')
image.push()
}
}
stage('Push to cluster') {
//sh "/usr/local/bin/kubectl set image deployment/boss boss=docker.fs.usda.gov/fia/boss:${env.BUILD_NUMBER}"
kubernetesDeploy configs: 'deploy/application-deployment.yaml', kubeConfig: [path: ''], kubeconfigId: 'kube_config_ead', secretName: '', ssh: [sshCredentialsId: '*', sshServer: ''], textCredentials: [certificateAuthorityData: '', clientCertificateData: '', clientKeyData: '', serverUrl: 'https://']
}
stage('Cleanup Docker') {
sh 'docker system prune -f'
}
// stage('Push to PaaS') {
// azureWebAppPublish appName: '76cbeba76cc8eb95', azureCredentialsId: 'azure_service_principal', filePath: 'webapps/*.war', publishType: 'file', resourceGroup: 'CIO-AUT001-DEV-RSG'
// }
}