docker-compose,docker: added compose files for a Jenkins instance

Signed-off-by: Marc Mattmüller <marc.mattmueller@netmodule.com>
This commit is contained in:
Marc Mattmüller 2023-06-20 22:40:13 +02:00
parent 8e54299b58
commit db36bd8e18
2 changed files with 153 additions and 0 deletions

32
docker-compose.yaml Normal file
View File

@ -0,0 +1,32 @@
services:
jenkins:
image: jenkins:nwl-0.0.1
container_name: jk_server_nwl
ports:
- 8080:8080
- 50000:50000
networks:
- jk_net
volumes:
- $PWD/jenkins_home:/var/jenkins_home
- $PWD/docker:/var/jenkins_conf
- $PWD/secrets/pw:/run/secrets
- $PWD/secrets/.ssh:/var/jenkins_home/.ssh
- $PWD/secrets/.cacerts:/var/jenkins_home/.cacerts
- $PWD/yocto-downloads:/var/jenkins_home/downloads
secrets:
- jenkinsUserAdmin
- jenkinsUserDeveloper
- gitSsh
- nexusUser
environment:
- COMPOSE_PROJECT_NAME=jk_server_nwl
- CASC_JENKINS_CONFIG=/var/jenkins_conf/nwl-cicd.yaml
- JENKINS_ADMIN_FILE_PATH=/run/secrets/jenkinsUserAdmin
- JENKINS_DEV_FILE_PATH=/run/secrets/jenkinsUserDeveloper
- SSH_GIT_PW_FILE_PATH=/run/secrets/gitSsh
- SSH_GIT_FILE_PATH=/var/jenkins_home/.ssh/testvm_ed25519
- NEXUS_USER_FILE_PATH=/run/secrets/nexusUser
networks:
jk_net:
driver: bridge

121
docker/nwl-cicd.yaml Normal file
View File

@ -0,0 +1,121 @@
jenkins:
systemMessage: "Ansible NWL Jenkins Controller"
scmCheckoutRetryCount: 3
mode: NORMAL
labelString: "nwl-jenkins-controller"
numExecutors: 6
securityRealm:
local:
allowsSignup: false
users:
- id: admin
password: "${readFileBase64:${JENKINS_ADMIN_FILE_PATH}}"
- id: developer
password: "${readFileBase64:${JENKINS_DEV_FILE_PATH}}"
authorizationStrategy:
globalMatrix:
permissions:
- "USER:Overall/Administer:admin"
- "GROUP:Overall/Read:authenticated"
- "GROUP:Agent/Build:authenticated"
- "GROUP:Job/Read:authenticated"
- "GROUP:Job/Build:authenticated"
- "GROUP:Job/Cancel:authenticated"
- "GROUP:Job/Workspace:authenticated"
- "GROUP:Run/Replay:authenticated"
- "GROUP:Run/Delete:authenticated"
crumbIssuer: "standard"
security:
GlobalJobDslSecurityConfiguration:
useScriptSecurity: true
queueItemAuthenticator:
authenticators:
- global:
strategy:
specificUsersAuthorizationStrategy:
userid: admin
credentials:
system:
domainCredentials:
- credentials:
- basicSSHUserPrivateKey:
scope: GLOBAL
id: gitCredentials
username: testvm
usernameSecret: true
passphrase: "${readFileBase64:${SSH_GIT_PW_FILE_PATH}}"
description: "git access over SSH"
privateKeySource:
directEntry:
privateKey: "${readFileBase64:${SSH_GIT_FILE_PATH}}"
- usernamePassword:
scope: GLOBAL
id: nexusCredentials
username: "ci-build-user"
usernameSecret: true
password: "${readFileBase64:${NEXUS_USER_FILE_PATH}}"
description: "Nexus artifactory access"
unclassified:
location:
url: http://10.115.101.101:8080
adminAddress: Mr Jenkins <no-reply@netmodule.com>
tool:
git:
installations:
- name: Default
home: "git"
jobs:
- script: >
multibranchPipelineJob('doc') {
displayName('10. Documentation')
description('Builds the Documentation of the work concerning NWL CI')
factory {
workflowBranchProjectFactory {
scriptPath('jobs/Jenkinsfile_Documentation')
}
}
orphanedItemStrategy {
discardOldItems {
numToKeep(5)
}
}
branchSources {
git {
id('build-doc')
remote('ssh://git@bitbucket.gad.local:7999/nm-nsp/nwl-ci.git')
credentialsId('gitCredentials')
includes('main develop release*')
}
}
}
multibranchPipelineJob('nwl-build-pipeline') {
displayName('1. NWL CI Pipeline')
description('CI pipeline for the NetModule Wireless Linux')
factory {
workflowBranchProjectFactory {
scriptPath('jobs/Jenkinsfile_Build')
}
}
orphanedItemStrategy {
discardOldItems {
numToKeep(5)
}
}
branchSources {
git {
id('nwl-ci')
remote('ssh://git@bitbucket.gad.local:7999/nm-nsp/nwl-ci.git')
credentialsId('gitCredentials')
includes('main release*')
}
}
}