ICR integration #51

Merged
mpavlov merged 2 commits from dev into master 2026-02-13 01:04:09 +03:00

32
Jenkinsfile vendored
View File

@@ -10,9 +10,13 @@ pipeline {
ansiColor('xterm')
timestamps()
}
environment {
INFRA_CONFIG_REPO = credentials("INFRA_CONFIG_REPO")
}
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: "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')
}
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') {
steps {
script {
images_repo_url = infraVars["${params.repo_location}"]["repos"]["registry_url"]
withCredentials([
sshUserPrivateKey(credentialsId: 'JENKINS_DEPLOYER_KEY', keyFileVariable: 'SSH_KEY'),
usernamePassword(credentialsId:'JENKINS_DEPLOYER_PASS', usernameVariable: 'username', passwordVariable: 'password')
@@ -52,10 +72,12 @@ pipeline {
playbook: 'rproxy.yml',
inventory: 'hosts.ini',
colorized: true,
extras: '''--private-key ${SSH_KEY}
-e "ansible_user=${username}
ansible_password=${password}
image_repo=${images_repo_url}"'''
extras: "--private-key ${SSH_KEY}",
extraVars: [
ansible_user: [value: "${username}", hidden: false],
ansible_password: [value: "${password}", hidden: true],
image_repo: [value: "${images_repo_url}", hidden: false]
]
)
}
}