fix docker&jenkinsfile+legacyjen

This commit is contained in:
reqwizz 2024-11-04 19:49:57 +03:00
parent 589b269ae3
commit f32cc1b6a0
2 changed files with 4 additions and 18 deletions

8
ansible/Jenkinsfile vendored
View File

@ -14,7 +14,7 @@ pipeline {
stage('Decrypt SSH Key') { stage('Decrypt SSH Key') {
steps { steps {
script { script {
def tempDir = '/var/jenkins_home/workspace/Sites' + UUID.randomUUID().toString() def tempDir = '/tmp/' + UUID.randomUUID().toString()
env.TEMP_DIR = tempDir env.TEMP_DIR = tempDir
sh "mkdir -p ${tempDir}" sh "mkdir -p ${tempDir}"
@ -51,11 +51,11 @@ pipeline {
def sanitized_content = params.ADDITIONAL_CONTENT.replaceAll("'", "\\'").replaceAll('"', '\\"') def sanitized_content = params.ADDITIONAL_CONTENT.replaceAll("'", "\\'").replaceAll('"', '\\"')
if (params.SITE_OPTION == 'SiteA') { if (params.SITE_OPTION == 'SiteA') {
sh "export PATH=/usr/local/bin:\$PATH && ansible-playbook ansible/playbook.yml -i ${env.HOSTS_FILE} -l SiteA -e \"additional_content='${sanitized_content}'\"" sh "export PATH=/usr/local/bin:\$PATH && ansible-playbook /coursework/ansible/playbook.ymlansible/playbook.yml -i ${env.HOSTS_FILE} -l SiteA -e \"additional_content='${sanitized_content}'\""
} else if (params.SITE_OPTION == 'SiteB') { } else if (params.SITE_OPTION == 'SiteB') {
sh "export PATH=/usr/local/bin:\$PATH && ansible-playbook ansible/playbook.yml -i ${env.HOSTS_FILE} -l SiteB -e \"additional_content='${sanitized_content}'\"" sh "export PATH=/usr/local/bin:\$PATH && ansible-playbook /coursework/ansible/playbook.ymlansible/playbook.yml -i ${env.HOSTS_FILE} -l SiteB -e \"additional_content='${sanitized_content}'\""
} else if (params.SITE_OPTION == 'SiteA&B') { } else if (params.SITE_OPTION == 'SiteA&B') {
sh "export PATH=/usr/local/bin:\$PATH && ansible-playbook ansible/playbook.yml -i ${env.HOSTS_FILE} -l SiteA,SiteB,proxy -e \"additional_content='${sanitized_content}'\"" sh "export PATH=/usr/local/bin:\$PATH && ansible-playbook /coursework/ansible/playbook.yml -i ${env.HOSTS_FILE} -l SiteA,SiteB,proxy -e \"additional_content='${sanitized_content}'\""
} }
} }
} }

View File

@ -1,17 +1,4 @@
services: services:
jenkins:
image: jenkins/jenkins:latest
container_name: jenkins
privileged: true
user: root
volumes:
- ./jenkins-data:/var/jenkins_home
- ./ansible:/ansible
ports:
- "8080:8080"
- "50000:50000"
restart: always
gitea: gitea:
image: gitea/gitea:latest image: gitea/gitea:latest
container_name: gitea container_name: gitea
@ -26,5 +13,4 @@ services:
restart: always restart: always
volumes: volumes:
jenkins-data:
gitea-data: gitea-data: