Skip to content

Commit

Permalink
wip change agent to arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
smerle33 committed Jan 3, 2024
1 parent a5e7705 commit 7ccc42b
Showing 1 changed file with 46 additions and 37 deletions.
83 changes: 46 additions & 37 deletions vars/terraform.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def call(userConfig = [:]) {
stagingCredentials: [], // No custom secrets for staging by default
productionCredentials: [], // No custom secrets for production by default
productionBranch: 'main', // Defaults to the principal branch
agentLabel: 'jnlp-linux-arm64', // replace agentContainerImage
agentContainerImage: 'jenkinsciinfra/hashicorp-tools:1.0.57', // Version managed by updatecli
runTests: false, // Executes the tests provided by the "calling" project, which should provide a tests/Makefile
runCommonTests: true, // Executes the default test suite from the shared tools repository (terratest)
Expand Down Expand Up @@ -140,43 +141,51 @@ def call(userConfig = [:]) {
}

def agentTemplate(containerImage, body) {
podTemplate(
// Custom YAML definition to enforce no service account token (if Terraform uses kubernetes, it would grant it a wrong access)
yaml: '''
apiVersion: v1
kind: Pod
spec:
automountServiceAccountToken: false
nodeSelector:
kubernetes.azure.com/agentpool: infracipool
kubernetes.io/os: linux
tolerations:
- key: "jenkins"
operator: "Equal"
value: "infra.ci.jenkins.io"
effect: "NoSchedule"
- key: "kubernetes.azure.com/scalesetpriority"
operator: "Equal"
value: "spot"
effect: "NoSchedule"
resources:
limits:
cpu: 2
memory: 2Gi
requests:
cpu: 2
memory: 2Gi
''',
// The Docker image here is aimed at "1 container per pod" and is embedding Jenkins agent tooling
containers: [containerTemplate(name: 'jnlp', image: containerImage)]) {
node(POD_LABEL) {
timeout(time: 1, unit: 'HOURS') {
ansiColor('xterm') {
body.call()
}
}
}
}
agent {
label 'agentLabel'
}
timeout(time: 1, unit: 'HOURS') {
ansiColor('xterm') {
body.call()
}
}
// podTemplate(
// // Custom YAML definition to enforce no service account token (if Terraform uses kubernetes, it would grant it a wrong access)
// yaml: '''
// apiVersion: v1
// kind: Pod
// spec:
// automountServiceAccountToken: false
// nodeSelector:
// kubernetes.azure.com/agentpool: infracipool
// kubernetes.io/os: linux
// tolerations:
// - key: "jenkins"
// operator: "Equal"
// value: "infra.ci.jenkins.io"
// effect: "NoSchedule"
// - key: "kubernetes.azure.com/scalesetpriority"
// operator: "Equal"
// value: "spot"
// effect: "NoSchedule"
// resources:
// limits:
// cpu: 2
// memory: 2Gi
// requests:
// cpu: 2
// memory: 2Gi
// ''',
// // The Docker image here is aimed at "1 container per pod" and is embedding Jenkins agent tooling
// containers: [containerTemplate(name: 'jnlp', image: containerImage)]) {
// node(POD_LABEL) {
// timeout(time: 1, unit: 'HOURS') {
// ansiColor('xterm') {
// body.call()
// }
// }
// }
// }
}


Expand Down

0 comments on commit 7ccc42b

Please sign in to comment.