Skip to content

Commit

Permalink
Merge pull request #4067 from devgateway/hotfix/v3.5.5.1
Browse files Browse the repository at this point in the history
Hotfix/v3.5.5.1
  • Loading branch information
jdeanquin-dg authored Jul 3, 2023
2 parents fac79af + 1b02758 commit 423728d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 16 deletions.
41 changes: 28 additions & 13 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def dbVersion
def pgVersion = 14
def country
def ampUrl
def dockerRepo = "registry.developmentgateway.org/"
def dockerRepo = "798366298150.dkr.ecr.us-east-1.amazonaws.com/"

def updateGitHubCommitStatus(context, message, state) {
repoUrl = sh(returnStdout: true, script: "git config --get remote.origin.url").trim()
Expand All @@ -49,9 +49,20 @@ def updateGitHubCommitStatus(context, message, state) {

def codeVersion
def countries
def environment

stage('Build') {

timeout(15) {
milestone()
environment = input(
message: "Server to deploy",
parameters: [choice(choices: ["${env.AMP_STAGING_HOSTNAME}", "${env.AMP_DE_HOSTNAME}"], name: 'environment')])
milestone()
}

println "Using environment: ${environment}"

node {
checkout scm

Expand All @@ -60,7 +71,7 @@ stage('Build') {
println "AMP Version: ${codeVersion}"

countries = sh(returnStdout: true,
script: "ssh boad.aws.devgateway.org 'cd /opt/amp_dbs && amp-db ls ${codeVersion} | sort'")
script: "ssh ${environment} 'cd /opt/amp_dbs && amp-db ls ${codeVersion} | sort'")
.trim()
if (countries == "") {
println "There are no database backups compatible with ${codeVersion}"
Expand All @@ -76,19 +87,23 @@ stage('Build') {
milestone()
}

ampUrl = "http://amp-${country}-${tag}.stg.ampsite.net/"
println "Let set amp url based on ${environment}"

if ("${environment}".toLowerCase().contains("ampdevde")) {
ampUrl = "http://amp-${country}-${tag}.de.ampsite.net/"
} else {
ampUrl = "http://amp-${country}-${tag}.stg.ampsite.net/"
}

println "amp url is ${ampUrl}"

node {
checkout scm

def image = "${dockerRepo}amp-webapp:${tag}"
def format = branch != null ? "%H" : "%P"
def hash = sh(returnStdout: true, script: "git log --pretty=${format} -n 1").trim()
sh(returnStatus: true, script: "docker pull ${image} > /dev/null")
def imageIds = sh(returnStdout: true, script: "docker images -q -f \"label=git-hash=${hash}\"").trim()
sh(returnStatus: true, script: "docker rmi ${image} > /dev/null")
def image = "${dockerRepo}amp/webapp:${tag}"
def hash = sh(returnStdout: true, script: "git log --pretty=%H -n 1").trim()

if (imageIds.equals("")) {
docker.withRegistry("https://798366298150.dkr.ecr.us-east-1.amazonaws.com", "ecr:us-east-1:aws-ecr-credentials-id") {
try {
updateGitHubCommitStatus('jenkins/build', 'Build in progress', 'PENDING')

Expand Down Expand Up @@ -127,10 +142,10 @@ stage('Deploy') {
node {
try {
// Find latest database version compatible with ${codeVersion}
dbVersion = sh(returnStdout: true, script: "ssh boad.aws.devgateway.org 'cd /opt/amp_dbs && amp-db find ${codeVersion} ${country}'").trim()
dbVersion = sh(returnStdout: true, script: "ssh ${environment} 'cd /opt/amp_dbs && amp-db find ${codeVersion} ${country}'").trim()

// Deploy AMP
sh "ssh boad.aws.devgateway.org 'amp-up ${tag} ${country} ${dbVersion} ${pgVersion}'"
sh "ssh ${environment} 'amp-up2 ${tag} ${country} ${dbVersion} ${pgVersion}'"

slackSend(channel: 'amp-ci', color: 'good', message: "Deploy AMP - Success\nDeployed ${changePretty} will be ready for testing at ${ampUrl} in about 3 minutes")

Expand All @@ -155,7 +170,7 @@ stage('Deploy again') {
}
node {
try {
sh "ssh boad.aws.devgateway.org 'amp-up ${tag} ${country} ${dbVersion} ${pgVersion}'"
sh "ssh ${environment} 'amp-up2 ${tag} ${country} ${dbVersion} ${pgVersion}'"

slackSend(channel: 'amp-ci', color: 'good', message: "Deploy AMP - Success\nDeployed ${changePretty} will be ready for testing at ${ampUrl} in about 3 minutes")

Expand Down
2 changes: 1 addition & 1 deletion amp/TEMPLATE/ampTemplate/site-config.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE page [
<!ENTITY ampVersion "${project.version}">
<!ENTITY releaseDate "14.10.2022">
<!ENTITY releaseDate "03.07.2023">
<!ENTITY buildDate "${buildDate}">
<!ENTITY buildSource "${buildSource}">
]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export function loadActivityForActivityPreview(activityId) {
fundings.forEach(funding => {
const fundingFromConverted =
activityFundingInformation[FUNDING_INFORMATION][ActivityConstants.FUNDINGS].find(fundingInWsCurrency =>
funding[ActivityConstants.FUNDING_ID] === fundingInWsCurrency[ActivityConstants.FUNDING_ID]);
funding[ActivityConstants.AMP_FUNDING_ID] === fundingInWsCurrency[ActivityConstants.AMP_FUNDING_ID]);
if (activityFundingInformation) {
transactions.forEach(tt => {
const rawTransactionsList = funding[tt];
Expand Down
2 changes: 1 addition & 1 deletion amp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.devgateway</groupId>
<artifactId>amp</artifactId>
<version>3.5.5</version>
<version>3.5.5.1</version>
<packaging>war</packaging>
<name>Aid Management Platform</name>
<properties>
Expand Down

0 comments on commit 423728d

Please sign in to comment.