Skip to content

Commit 8d73793

Browse files
authored
Merge pull request #604 from devgateway/hotfix/v2.12.7.3
AMP 2.12.7.3 release
2 parents d6a73fa + ef29ed0 commit 8d73793

File tree

7,387 files changed

+1728
-1295294
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

7,387 files changed

+1728
-1295294
lines changed

Jenkinsfile

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
#!groovy
2+
3+
// Important: What is BRANCH_NAME?
4+
// It is branch name for builds triggered from branches.
5+
// It is PR-<pr-id> for builds triggered from pull requests.
6+
def tag
7+
if (BRANCH_NAME ==~ /feature\/AMP-\d+.*/) {
8+
def jiraId = (BRANCH_NAME =~ /feature\/AMP-(\d+).*/)[0][1]
9+
tag = "feature-${jiraId}"
10+
} else {
11+
tag = BRANCH_NAME.replaceAll(/[^a-zA-Z0-9_-]/, "-").toLowerCase()
12+
}
13+
14+
// Record original branch or pull request for cleanup jobs
15+
def branch = env.CHANGE_ID == null ? BRANCH_NAME : null
16+
def pr = env.CHANGE_ID
17+
18+
println "Branch: ${branch}"
19+
println "Pull request: ${pr}"
20+
println "Tag: ${tag}"
21+
22+
def codeVersion
23+
def dbVersion
24+
25+
stage('Build') {
26+
node {
27+
checkout scm
28+
withEnv(["PATH+MAVEN=${tool 'M339'}/bin"]) {
29+
30+
// Build AMP
31+
sh "cd amp && mvn -T 4 clean compile war:exploded -Djdbc.user=amp -Djdbc.password=amp122006 -Djdbc.db=amp -Djdbc.host=db -Djdbc.port=5432 -DdbName=postgresql -Djdbc.driverClassName=org.postgresql.Driver -Dmaven.test.skip=true -Dapidocs=true -DbuildVersion=AMP -DbuildSource=${tag} -e"
32+
33+
// Find AMP version
34+
codeVersion = (readFile('amp/TEMPLATE/ampTemplate/site-config.xml') =~ /(?s).*<\!ENTITY ampVersion "([\d\.]+)">.*/)[0][1]
35+
36+
// Build Docker images & push it
37+
sh "docker build -q -t localhost:5000/amp-webapp:${tag} --build-arg AMP_EXPLODED_WAR=target/amp-AMP --build-arg AMP_PULL_REQUEST='${pr}' --build-arg AMP_BRANCH='${branch}' amp"
38+
sh "docker push localhost:5000/amp-webapp:${tag} > /dev/null"
39+
40+
// Cleanup after Docker & Maven
41+
sh "docker rmi localhost:5000/amp-webapp:${tag}"
42+
sh "cd amp && mvn clean -Djdbc.db=dummy"
43+
}
44+
}
45+
}
46+
47+
def deployed = false
48+
def country
49+
50+
def changePretty = (pr != null) ? "pull request ${pr}" : "branch ${branch}"
51+
def ampUrl
52+
53+
// If this stage fails then next stage will retry deployment. Otherwise next stage will be skipped.
54+
stage('Deploy') {
55+
56+
// Find list of countries which have database dumps compatible with ${codeVersion}
57+
def countries
58+
node {
59+
countries = sh(returnStdout: true, script: "ssh sulfur 'cd /opt/amp_dbs && amp-db ls ${codeVersion}'").trim()
60+
if (countries == "") {
61+
println "There are no database backups compatible with ${codeVersion}"
62+
currentBuild.result = 'FAILURE'
63+
}
64+
}
65+
66+
timeout(time: 3, unit: 'DAYS') {
67+
milestone()
68+
country = input message: "Proceed with deploy?", parameters: [choice(choices: countries, name: 'country')]
69+
milestone()
70+
}
71+
72+
ampUrl = "http://amp-${country}-${tag}-tc9.ampsite.net/"
73+
74+
node {
75+
try {
76+
// Find latest database version compatible with ${codeVersion}
77+
dbVersion = sh(returnStdout: true, script: "ssh sulfur 'cd /opt/amp_dbs && amp-db find ${codeVersion} ${country}'").trim()
78+
79+
// Deploy AMP
80+
sh "ssh sulfur 'cd /opt/docker/amp && ./up.sh ${tag} ${country} ${dbVersion}'"
81+
82+
slackSend(channel: 'amp-ci', color: 'good', message: "Deploy AMP - Success\nDeployed ${changePretty} will be ready for testing at ${ampUrl} in about 3 minutes")
83+
84+
deployed = true
85+
} catch (e) {
86+
slackSend(channel: 'amp-ci', color: 'warning', message: "Deploy AMP - Failed\nFailed to deploy ${changePretty}")
87+
88+
currentBuild.result = 'UNSTABLE'
89+
}
90+
}
91+
}
92+
93+
// Retry deploy with the same country.
94+
stage('Deploy again') {
95+
if (deployed) {
96+
println 'Already deployed, skipping this step.'
97+
} else {
98+
timeout(time: 7, unit: 'DAYS') {
99+
milestone()
100+
input message: "Proceed with repeated deploy for ${country}?"
101+
milestone()
102+
}
103+
node {
104+
try {
105+
sh "ssh sulfur 'cd /opt/docker/amp && ./up.sh ${tag} ${country} ${dbVersion}'"
106+
107+
slackSend(channel: 'amp-ci', color: 'good', message: "Deploy AMP - Success\nDeployed ${changePretty} will be ready for testing at ${ampUrl} in about 3 minutes")
108+
109+
currentBuild.result = 'SUCCESS'
110+
} catch (e) {
111+
slackSend(channel: 'amp-ci', color: 'warning', message: "Deploy AMP - Failed\nFailed to deploy ${changePretty}")
112+
113+
throw e
114+
}
115+
}
116+
}
117+
}

amp-cms/.editorconfig

Lines changed: 0 additions & 28 deletions
This file was deleted.

amp-cms/.gitignore

Lines changed: 0 additions & 22 deletions
This file was deleted.

amp-cms/.htaccess_sample

Lines changed: 0 additions & 146 deletions
This file was deleted.

0 commit comments

Comments
 (0)