ICR integration

This commit is contained in:
2026-01-17 19:05:14 +03:00
committed by Pavlov
parent ed7594cea8
commit 7c3b63c8c9

32
Jenkinsfile vendored
View File

@@ -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]
]
) )
} }
} }