Bug 1841 Partial Revert
[osm/devops.git] / jenkins / ci-pipelines / ci_stage_3.groovy
index e93c9a9..d17d46e 100644 (file)
@@ -32,7 +32,7 @@ properties([
         string(defaultValue: 'artifactory-osm', description: '', name: 'ARTIFACTORY_SERVER'),
         string(defaultValue: 'osm-stage_4', description: '', name: 'DOWNSTREAM_STAGE_NAME'),
         string(defaultValue: 'testing-daily', description: '', name: 'DOCKER_TAG'),
-        string(defaultValue: 'ubuntu18.04', description: '', name: 'OPENSTACK_BASE_IMAGE'),
+        string(defaultValue: 'ubuntu20.04', description: '', name: 'OPENSTACK_BASE_IMAGE'),
         booleanParam(defaultValue: false, description: '', name: 'SAVE_CONTAINER_ON_FAIL'),
         booleanParam(defaultValue: false, description: '', name: 'SAVE_CONTAINER_ON_PASS'),
         booleanParam(defaultValue: true, description: '', name: 'SAVE_ARTIFACTS_ON_SMOKE_SUCCESS'),
@@ -161,6 +161,7 @@ node("${params.NODE}") {
 
     INTERNAL_DOCKER_REGISTRY = 'osm.etsi.org:5050/devops/cicd/'
     INTERNAL_DOCKER_PROXY = 'http://172.21.1.1:5000'
+    APT_PROXY="http://172.21.1.1:3142"
     SSH_KEY = '~/hive/cicd_rsa'
     sh 'env'
 
@@ -322,7 +323,8 @@ node("${params.NODE}") {
                                 usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
                     sh "docker login ${INTERNAL_DOCKER_REGISTRY} -u ${USERNAME} -p ${PASSWORD}"
                 }
-                moduleBuildArgs = ""
+                datetime = sh(returnStdout: true, script: "date +%Y-%m-%d:%H:%M:%S").trim()
+                moduleBuildArgs = " --build-arg CACHE_DATE=${datetime}"
                 for (packageName in builtModules.keySet()) {
                     envName=packageName.replaceAll("-","_").toUpperCase()+"_URL"
                     moduleBuildArgs += " --build-arg ${envName}=" + builtModules[packageName]
@@ -340,7 +342,7 @@ node("${params.NODE}") {
                             def moduleTag = container_name
                             parallelSteps[module] = {
                                 dir("$module") {
-                                    sh "docker build -t opensourcemano/${moduleName}:${moduleTag} ${moduleBuildArgs} ."
+                                    sh "docker build --build-arg APT_PROXY=${APT_PROXY} -t opensourcemano/${moduleName}:${moduleTag} ${moduleBuildArgs} ."
                                     println("Tagging ${moduleName}:${moduleTag}")
                                     sh "docker tag opensourcemano/${moduleName}:${moduleTag} ${INTERNAL_DOCKER_REGISTRY}opensourcemano/${moduleName}:${moduleTag}"
                                     sh "docker push ${INTERNAL_DOCKER_REGISTRY}opensourcemano/${moduleName}:${moduleTag}"
@@ -444,8 +446,17 @@ node("${params.NODE}") {
                     remote.logLevel = 'INFO'
                     remote.pty = true
 
+                    // Force time sync to avoid clock drift and invalid certificates
                     sshCommand remote: remote, command: """
-                        wget https://osm-download.etsi.org/ftp/osm-10.0-ten/install_osm.sh
+                        sudo apt update
+                        sudo apt install -y ntp
+                        sudo service ntp stop
+                        sudo ntpd -gq
+                        sudo service ntp start
+                    """
+
+                    sshCommand remote: remote, command: """
+                        wget https://osm-download.etsi.org/ftp/osm-11.0-eleven/install_osm.sh
                         chmod +x ./install_osm.sh
                         sed -i '1 i\\export PATH=/snap/bin:\${PATH}' ~/.bashrc
                     """