Merge pull request 'ICR integration' (#51) from dev into master
Reviewed-on: https://remvpn.olssonul.com/iac/rproxy/pulls/51
This commit is contained in:
32
Jenkinsfile
vendored
32
Jenkinsfile
vendored
@@ -10,9 +10,13 @@ pipeline {
|
|||||||
ansiColor('xterm')
|
ansiColor('xterm')
|
||||||
timestamps()
|
timestamps()
|
||||||
}
|
}
|
||||||
|
environment {
|
||||||
|
INFRA_CONFIG_REPO = credentials("INFRA_CONFIG_REPO")
|
||||||
|
}
|
||||||
parameters {
|
parameters {
|
||||||
|
choice(name: "infra", choices: ['prod', 'dev'], description: "Select infrastructure type")
|
||||||
|
choice(name: "repo_location", choices: ['local', 'remote'], description: "Select repository location")
|
||||||
string(name: "target_host", defaultValue: "", trim: true, description: "Target host for rproxy installation")
|
string(name: "target_host", defaultValue: "", trim: true, description: "Target host for rproxy installation")
|
||||||
string(name: "images_repo_url", defaultValue: "", trim: true, description: "Repository host with podman images (ex. rproxy.olsson.ul:5000)")
|
|
||||||
booleanParam(name: 'update_job', defaultValue: false, description: 'Update job, free run, no changes')
|
booleanParam(name: 'update_job', defaultValue: false, description: 'Update job, free run, no changes')
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
@@ -39,9 +43,25 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stage('Get environment') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
dir('infra-config') {
|
||||||
|
git url: env.INFRA_CONFIG_REPO,
|
||||||
|
branch: params.infra,
|
||||||
|
credentialsId: 'JENKINS_GIT_ACCESS'
|
||||||
|
|
||||||
|
sh "ansible-playbook render.yml"
|
||||||
|
infraVars = readYaml file: "./global.yml"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
stage('Install Rproxy') {
|
stage('Install Rproxy') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
|
images_repo_url = infraVars["${params.repo_location}"]["repos"]["registry_url"]
|
||||||
|
|
||||||
withCredentials([
|
withCredentials([
|
||||||
sshUserPrivateKey(credentialsId: 'JENKINS_DEPLOYER_KEY', keyFileVariable: 'SSH_KEY'),
|
sshUserPrivateKey(credentialsId: 'JENKINS_DEPLOYER_KEY', keyFileVariable: 'SSH_KEY'),
|
||||||
usernamePassword(credentialsId:'JENKINS_DEPLOYER_PASS', usernameVariable: 'username', passwordVariable: 'password')
|
usernamePassword(credentialsId:'JENKINS_DEPLOYER_PASS', usernameVariable: 'username', passwordVariable: 'password')
|
||||||
@@ -52,10 +72,12 @@ pipeline {
|
|||||||
playbook: 'rproxy.yml',
|
playbook: 'rproxy.yml',
|
||||||
inventory: 'hosts.ini',
|
inventory: 'hosts.ini',
|
||||||
colorized: true,
|
colorized: true,
|
||||||
extras: '''--private-key ${SSH_KEY}
|
extras: "--private-key ${SSH_KEY}",
|
||||||
-e "ansible_user=${username}
|
extraVars: [
|
||||||
ansible_password=${password}
|
ansible_user: [value: "${username}", hidden: false],
|
||||||
image_repo=${images_repo_url}"'''
|
ansible_password: [value: "${password}", hidden: true],
|
||||||
|
image_repo: [value: "${images_repo_url}", hidden: false]
|
||||||
|
]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user