Skip to content
Snippets Groups Projects
Commit 31ecaa03 authored by ismail's avatar ismail
Browse files

CI: update on the cluster deployment CI

parent 153acc96
No related branches found
No related tags found
1 merge request!7Merging tutorials
...@@ -6,7 +6,7 @@ metadata: ...@@ -6,7 +6,7 @@ metadata:
labels: labels:
app: {{ template "mysql.fullname" . }} app: {{ template "mysql.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}" app.kubernetes.io/instance: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}" heritage: "{{ .Release.Service }}"
{{- with .Values.deploymentAnnotations }} {{- with .Values.deploymentAnnotations }}
annotations: annotations:
...@@ -19,12 +19,12 @@ spec: ...@@ -19,12 +19,12 @@ spec:
selector: selector:
matchLabels: matchLabels:
app: {{ template "mysql.fullname" . }} app: {{ template "mysql.fullname" . }}
release: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
template: template:
metadata: metadata:
labels: labels:
app: {{ template "mysql.fullname" . }} app: {{ template "mysql.fullname" . }}
release: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
{{- with .Values.podLabels }} {{- with .Values.podLabels }}
{{ toYaml . | indent 8 }} {{ toYaml . | indent 8 }}
{{- end }} {{- end }}
......
# mysql image version # mysql image version
## ref: https://hub.docker.com/r/library/mysql/tags/ ## ref: https://hub.docker.com/r/library/mysql/tags/
## ##
image: "mysql" image: "image-registry.openshift-image-registry.svc:5000/oaicicd-tmp/mysql-internal"
imageTag: "5.7.30" imageTag: "TAG"
strategy: strategy:
type: Recreate type: Recreate
......
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
replicaCount: 1 replicaCount: 1
namespace: "oaicicd-tmp" namespace: "PROJECT"
image: image:
registry: local registry: local
repository: image-registry.openshift-image-registry.svc:5000/oaicicd-tmp/oai-amf repository: image-registry.openshift-image-registry.svc:5000/PROJECT/oai-amf
version: develop version: "TAG"
# pullPolicy: IfNotPresent or Never or Always # pullPolicy: IfNotPresent or Never or Always
pullPolicy: Always pullPolicy: Always
......
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
replicaCount: 1 replicaCount: 1
namespace: "oaicicd-tmp" namespace: "PROJECT"
image: image:
registry: local registry: local
repository: image-registry.openshift-image-registry.svc:5000/oaicicd-tmp/oai-nrf repository: image-registry.openshift-image-registry.svc:5000/PROJECT/oai-nrf
version: develop version: TAG
# pullPolicy: IfNotPresent or Never or Always # pullPolicy: IfNotPresent or Never or Always
pullPolicy: Always pullPolicy: Always
......
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
replicaCount: 1 replicaCount: 1
namespace: "oaicicd-tmp" namespace: "PROJECT"
image: image:
registry: local registry: local
repository: oai-smf repository: image-registry.openshift-image-registry.svc:5000/PROJECT/oai-smf
version: develop version: TAG
#pullPolicy: IfNotPresent or Never or Always #pullPolicy: IfNotPresent or Never or Always
pullPolicy: Always pullPolicy: Always
......
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
replicaCount: 1 replicaCount: 1
namespace: "oaicicd-tmp" namespace: "PROJECT"
image: image:
registry: local registry: local
repository: image-registry.openshift-image-registry.svc:5000/oaicicd-tmp/oai-spgwu-tiny repository: image-registry.openshift-image-registry.svc:5000/PROJECT/oai-spgwu-tiny
version: develop version: TAG
# pullPolicy: IfNotPresent or Never or Always # pullPolicy: IfNotPresent or Never or Always
pullPolicy: Always pullPolicy: Always
......
...@@ -35,6 +35,7 @@ def sendSocialMediaMessage(pipeChannel, pipeColor, pipeMessage) { ...@@ -35,6 +35,7 @@ def sendSocialMediaMessage(pipeChannel, pipeColor, pipeMessage) {
def cn_ci_host = params.Host_CN_CI_Server def cn_ci_host = params.Host_CN_CI_Server
// for lock // for lock
def cn_ci_resource = params.CN_CI_Resource
def ds_tester_ci_resource = params.DsTester def ds_tester_ci_resource = params.DsTester
// Location of the DsTester workspace // Location of the DsTester workspace
...@@ -81,10 +82,12 @@ pipeline { ...@@ -81,10 +82,12 @@ pipeline {
JOB_TIMESTAMP = JOB_TIMESTAMP.trim() JOB_TIMESTAMP = JOB_TIMESTAMP.trim()
def allParametersPresent = true def allParametersPresent = true
if (params.eNB_IPAddress == null) { if (params.remote_IPAddress == null) {
allParametersPresent = false allParametersPresent = false
if (params.eNB_Credentials == null) { }
if (params.remote_Credentials == null) {
allParametersPresent = false allParametersPresent = false
}
if (params.OC_Credentials == null) { if (params.OC_Credentials == null) {
allParametersPresent = false allParametersPresent = false
} }
...@@ -100,7 +103,7 @@ pipeline { ...@@ -100,7 +103,7 @@ pipeline {
if (params.DS_Tester_Server_Flag != null) { if (params.DS_Tester_Server_Flag != null) {
dsT_host_flag = params.DS_Tester_Server_Flag dsT_host_flag = params.DS_Tester_Server_Flag
if (dsT_host_flag) { if (dsT_host_flag) {
def allParametersPresent = true allParametersPresent = true
if (params.DS_Tester_Server_Name == null) { if (params.DS_Tester_Server_Name == null) {
allParametersPresent = false allParametersPresent = false
} else { } else {
...@@ -134,7 +137,7 @@ pipeline { ...@@ -134,7 +137,7 @@ pipeline {
} }
} }
withCredentials([ withCredentials([
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.remote_Credentials}", usernameVariable: 'remote_Username', passwordVariable: 'remote_Password'],
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.OC_Credentials}", usernameVariable: 'OC_Username', passwordVariable: 'OC_Password'] [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.OC_Credentials}", usernameVariable: 'OC_Username', passwordVariable: 'OC_Password']
]) { ]) {
if (upstreamEvent) { if (upstreamEvent) {
...@@ -156,9 +159,9 @@ pipeline { ...@@ -156,9 +159,9 @@ pipeline {
sh "zip -r -qq oai-cn5g-fed.zip .git" sh "zip -r -qq oai-cn5g-fed.zip .git"
sh "mkdir -p archives DS-TEST-RESULTS" sh "mkdir -p archives DS-TEST-RESULTS"
// Prepare the workspace in the remote server // Prepare the workspace in the remote server
copyTo2ndServer('oai-cn5g-fed.zip', true, ${eNB_Username}, ${params.eNB_IPAddress}) copyTo2ndServer('oai-cn5g-fed.zip', true, ${remote_Username}, ${params.remote_IPAddress})
myShCmd('git clean -x -d -f > /dev/null 2>&1', true, ${eNB_Username}, ${params.eNB_IPAddress}) myShCmd('git clean -x -d -f > /dev/null 2>&1', true, ${remote_Username}, ${params.remote_IPAddress})
myShCmd('mkdir -p archives DS-TEST-RESULTS', true, ${eNB_Username}, ${params.eNB_IPAddress}) myShCmd('mkdir -p archives DS-TEST-RESULTS', true, ${remote_Username}, ${params.remote_IPAddress})
} }
if (scmEvent) { if (scmEvent) {
sh "git clean -x -d -f > /dev/null 2>&1" sh "git clean -x -d -f > /dev/null 2>&1"
...@@ -168,23 +171,23 @@ pipeline { ...@@ -168,23 +171,23 @@ pipeline {
sh "zip -r -qq oai-cn5g-fed.zip .git" sh "zip -r -qq oai-cn5g-fed.zip .git"
sh "mkdir -p archives DS-TEST-RESULTS" sh "mkdir -p archives DS-TEST-RESULTS"
// Prepare the workspace in remote server // Prepare the workspace in remote server
copyTo2ndServer('oai-cn5g-fed.zip', true, ${eNB_Username}, ${params.eNB_IPAddress}) copyTo2ndServer('oai-cn5g-fed.zip', true, ${remote_Username}, ${params.remote_IPAddress})
myShCmd('git clean -x -d -f > /dev/null 2>&1', true, ${eNB_Username}, ${params.eNB_IPAddress}) myShCmd('git clean -x -d -f > /dev/null 2>&1', true, ${remote_Username}, ${params.remote_IPAddress})
if ("MERGE".equals(env.gitlabActionType)) { if ("MERGE".equals(env.gitlabActionType)) {
myShCmd("./ci-scripts/doGitLabMerge.sh --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}", new_host_flag, new_host_user, new_host) myShCmd("./ci-scripts/doGitLabMerge.sh --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}", new_host_flag, new_host_user, new_host)
} }
myShCmd('mkdir -p archives DS-TEST-RESULTS', true, ${eNB_Username}, ${params.eNB_IPAddress}) myShCmd('mkdir -p archives DS-TEST-RESULTS', true, ${remote_Username}, ${params.remote_IPAddress})
} }
if ((!upstreamEvent) && (!scmEvent)) { if ((!upstreamEvent) && (!scmEvent)) {
sh "git clean -x -d -f > /dev/null 2>&1" sh "git clean -x -d -f > /dev/null 2>&1"
sh "zip -r -qq oai-cn5g-fed.zip .git" sh "zip -r -qq oai-cn5g-fed.zip .git"
sh "mkdir -p archives DS-TEST-RESULTS" sh "mkdir -p archives DS-TEST-RESULTS"
// Prepare the workspace in the remote server // Prepare the workspace in the remote server
copyTo2ndServer('oai-cn5g-fed.zip', true, ${eNB_Username}, ${params.eNB_IPAddress}) copyTo2ndServer('oai-cn5g-fed.zip', true, remote_Username, params.remote_IPAddress)
myShCmd('git clean -x -d -f > /dev/null 2>&1', true, ${eNB_Username}, ${params.eNB_IPAddress}) myShCmd('git clean -x -d -f > /dev/null 2>&1', true, remote_Username, params.remote_IPAddress)
myShCmd('mkdir -p archives DS-TEST-RESULTS', true, ${eNB_Username}, ${params.eNB_IPAddress}) myShCmd('mkdir -p archives DS-TEST-RESULTS', true, remote_Username, params.remote_IPAddress)
} }
imageTags = "oai-nrf:${nrfTag},oai-amf:${amfTag},oai-smf:${smfTag},oai-spgwu-tiny:${spgwuTag}" imageTags = "mysql:5.7.30,oai-nrf:${nrfTag},oai-amf:${amfTag},oai-smf:${smfTag},oai-spgwu-tiny:${spgwuTag}"
} }
} }
} }
...@@ -194,13 +197,15 @@ pipeline { ...@@ -194,13 +197,15 @@ pipeline {
script { script {
echo '\u2705 \u001B[32mDeploy CN5G in idle mode\u001B[0m' echo '\u2705 \u001B[32mDeploy CN5G in idle mode\u001B[0m'
withCredentials([ withCredentials([
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.remote_Credentials}", usernameVariable: 'remote_Username', passwordVariable: 'remote_Password'],
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.OC_Credentials}", usernameVariable: 'OC_Username', passwordVariable: 'OC_Password'] [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.OC_Credentials}", usernameVariable: 'OC_Username', passwordVariable: 'OC_Password']
]) { ]) {
try { dir('ci-scripts') {
sh "python3 helmDeploy.py --mode=Deploy --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --OCUserName=${OC_Username} --OCPassword=${OC_Password} --OCProjectName=${OC_ProjectName} --imageTags=${imageTags}" try {
} catch (Exception e) { sh "python3 helmDeploy.py --mode=Deploy --remoteIPAdd=${params.remote_IPAddress} --remoteUserName=${remote_Username} --remotePassword=${remote_Password} --OCUserName=${OC_Username} --OCPassword=${OC_Password} --OCProjectName=${OC_ProjectName} --imageTags=${imageTags}"
currentBuild.result = 'FAILURE' } catch (Exception e) {
currentBuild.result = 'FAILURE'
}
} }
} }
} }
...@@ -210,13 +215,15 @@ pipeline { ...@@ -210,13 +215,15 @@ pipeline {
steps { steps {
script { script {
withCredentials([ withCredentials([
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.remote_Credentials}", usernameVariable: 'remote_Username', passwordVariable: 'remote_Password'],
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.OC_Credentials}", usernameVariable: 'OC_Username', passwordVariable: 'OC_Password'] [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.OC_Credentials}", usernameVariable: 'OC_Username', passwordVariable: 'OC_Password']
]) { ]) {
try { dir('ci-scripts') {
sh "python3 helmDeploy.py --mode=UnDeploy --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --OCUserName=${OC_Username} --OCPassword=${OC_Password} --OCProjectName=${OC_ProjectName} --imageTags=${imageTags}" try {
} catch (Exception e) { sh "python3 helmDeploy.py --mode=UnDeploy --remoteIPAdd=${params.remote_IPAddress} --remoteUserName=${remote_Username} --remotePassword=${remote_Password} --OCUserName=${OC_Username} --OCPassword=${OC_Password} --OCProjectName=${OC_ProjectName} --imageTags=${imageTags}"
currentBuild.result = 'FAILURE' } catch (Exception e) {
currentBuild.result = 'FAILURE'
}
} }
} }
} }
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment