From 1849831185ad2410f95e6112480e2a5ee780ec5b Mon Sep 17 00:00:00 2001 From: TommyLike Date: Mon, 28 Oct 2019 10:39:31 +0800 Subject: [PATCH] Append jenkins file change for testing --- ci/NOTES.md | 6 +++++- ci/jenkins/hw_override.yaml | 34 ++++++++++++++++++++------------ ci/jenkins/templates/config.yaml | 12 ++++------- ci/slave-scripts/authorized_keys | 1 + ci/slave-scripts/centos.sh | 24 ++++++++++++++++++++++ ci/slave-scripts/opensuse.sh | 24 ++++++++++++++++++++++ ci/slave-scripts/setup.sh | 9 +++++++++ 7 files changed, 88 insertions(+), 22 deletions(-) create mode 100644 ci/slave-scripts/authorized_keys create mode 100644 ci/slave-scripts/centos.sh create mode 100644 ci/slave-scripts/opensuse.sh create mode 100755 ci/slave-scripts/setup.sh diff --git a/ci/NOTES.md b/ci/NOTES.md index 35c1ac1..7d7431e 100644 --- a/ci/NOTES.md +++ b/ci/NOTES.md @@ -12,4 +12,8 @@ resources into kubernetes cluster. # Command to generate the final yaml ```$xslt helm template ./jenkins --namespace jenkins-system -f jenkins/values.yaml -f jenkins/hw_override.yaml --name openeuler -``` \ No newline at end of file +``` + +# Node Notes +jenkins slave's working dir will be put at the path of `/jenkins_agent_dir` therefore it's required to make the folder ready +before assign any pods into that nodes. \ No newline at end of file diff --git a/ci/jenkins/hw_override.yaml b/ci/jenkins/hw_override.yaml index 7ee29f5..d0e5a92 100644 --- a/ci/jenkins/hw_override.yaml +++ b/ci/jenkins/hw_override.yaml @@ -8,11 +8,11 @@ master: # test pod will be created to test the readness of master web UI if enabled. testEnabled: false # used to specify the Elb ID which used for master service - huaweielbID: 1b8c18b6-0dd1-411a-b3bc-393bccd8d718 + huaweielbID: e1bb61d2-6101-419f-97d8-c76b1020a0c1 # used to specify the service type of master service serviceType: LoadBalancer # EIP for node load balancer - loadBalancerIP: 159.138.51.146 + loadBalancerIP: 114.116.250.98 # used to specify the service port for master web UI servicePort: 80 # used to specify the service node port for master web UI @@ -23,7 +23,7 @@ master: # request resource for master pod resources: requests: - cpu: "4000m" + cpu: "8000m" memory: "8192Mi" limits: cpu: "8000m" @@ -64,13 +64,17 @@ agent: # Resource request for cloud 1 agents. resources: requests: - cpu: "8000m" - memory: "8192Mi" - limits: - cpu: "8000m" - memory: "8192Mi" + cpu: "2000m" + memory: "4096Mi" #Used in job to specify which kind of agent to use for example arm or x86 componentName: "jenkins-slave-x86" + envVars: + - name: JENKINS_AGENT_WORKDIR + value: /home/jenkins/agent-working-dir + volumes: + - type: HostPath + mountPath: /home/jenkins/agent-working-dir + hostPath: /jenkins_agent_dir #Configure option for cloud 2 provider cloud2: name: kubernetes-arm-cluster @@ -82,13 +86,17 @@ agent: # Resource request for cloud 2 agents. resources: requests: - cpu: "8000m" - memory: "8192Mi" - limits: - cpu: "8000m" - memory: "8192Mi" + cpu: "2000m" + memory: "4096Mi" #Used in job to specify which kind of agent to use for example arm or x86 componentName: "jenkins-slave-arm" + envVars: + - name: JENKINS_AGENT_WORKDIR + value: /home/jenkins/agent-working-dir + volumes: + - type: HostPath + mountPath: /home/jenkins/agent-working-dir + hostPath: /jenkins_agent_dir persistence: # Whether to enable persistent volume diff --git a/ci/jenkins/templates/config.yaml b/ci/jenkins/templates/config.yaml index 00f82d0..db3a40f 100644 --- a/ci/jenkins/templates/config.yaml +++ b/ci/jenkins/templates/config.yaml @@ -62,7 +62,7 @@ data: {{- end }} EXCLUSIVE -{{- range $index, $volume := .Values.agent.volumes }} +{{- range $index, $volume := .Values.agent.cloud1.volumes }} {{- range $key, $value := $volume }}{{- if not (eq $key "type") }} <{{ $key }}>{{ $value }} @@ -97,8 +97,6 @@ data: # enough time to migrate. {{.Values.agent.cloud1.resources.requests.cpu}} {{.Values.agent.cloud1.resources.requests.memory}} - {{.Values.agent.cloud1.resources.limits.cpu}} - {{.Values.agent.cloud1.resources.limits.memory}} JENKINS_URL @@ -108,7 +106,7 @@ data: -{{- range $index, $var := .Values.agent.envVars }} +{{- range $index, $var := .Values.agent.cloud1.envVars }} {{ $var.name }} {{ $var.value }} @@ -169,7 +167,7 @@ data: {{- end }} EXCLUSIVE -{{- range $index, $volume := .Values.agent.volumes }} +{{- range $index, $volume := .Values.agent.cloud2.volumes }} {{- range $key, $value := $volume }}{{- if not (eq $key "type") }} <{{ $key }}>{{ $value }} @@ -204,8 +202,6 @@ data: # enough time to migrate. {{.Values.agent.cloud2.resources.requests.cpu}} {{.Values.agent.cloud2.resources.requests.memory}} - {{.Values.agent.cloud2.resources.limits.cpu}} - {{.Values.agent.cloud2.resources.limits.memory}} JENKINS_URL @@ -215,7 +211,7 @@ data: -{{- range $index, $var := .Values.agent.envVars }} +{{- range $index, $var := .Values.agent.cloud2.envVars }} {{ $var.name }} {{ $var.value }} diff --git a/ci/slave-scripts/authorized_keys b/ci/slave-scripts/authorized_keys new file mode 100644 index 0000000..c73f849 --- /dev/null +++ b/ci/slave-scripts/authorized_keys @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDbJoHskFbcEYm2qbBWPbc0FJyMOum3w4/9/NfJ50FPreGBe6icadNfm08/pYVB9W7do/g262bt/PC96fJWpuPdFIB2TX7rxlBiI+DYXNZdwuaLBjTTTPWJSKK3d97noYg5HXPI1JqTb7LDQLiushU/pZA8hYlwyUNsPsBo/Vs7WIbC1xf153AHdjOE4Q0G0Ab56oFdy9g9g8avdUDuLojWgfJJqobQM5r5V7vJBNk9jnPD8mOikV/pjl09mmmxgNfVDuu9/I+9ySLOZ4zvZU6Y7uCy8gtKgGUfWtnWlcfuUdeLfK3+Gfd9NBGx8tZu0t5VHM6h+VXgUCoRmVRPjgtAbM3ERioZsXdzN+Qv87e6CY4tTlOkeToXIrzb8TLK5S2y7ERfKIaugeIxlsUG0aAz2+F5t3xweqdqhpU2vupjQEJ8FyYvVzKj4IE63hfUeVuNQmIg1bpsw0oAPm+nQwOWr/e49aBp1NoR6F9HVE/TjhZuDCaejmEN7VMHPmGVcUXG8RqgYzXFfkuWlwpT4YT0J+u+lYuLa3ozM/dNckk92mbg+mD3ccAoPwZlWjVp+BFfKQBKpRfUNncwaU0Y6UtxA7co80KdzrkA6xse2/r7ApUmj6mP12z7L6nj8+mv500F7dHkxmrQQnmpG6ovY+XqZTZFYOlHHUrbjXJEsoSPkw== jenkins_master \ No newline at end of file diff --git a/ci/slave-scripts/centos.sh b/ci/slave-scripts/centos.sh new file mode 100644 index 0000000..912d2d3 --- /dev/null +++ b/ci/slave-scripts/centos.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +disk_name=$1 + +if [[ ! -e ${disk_name} ]]; then + echo "disk ${disk_name} not existed" + exit 1 +fi + +if [[ ! -e ~/.ssh/authorized_keys ]]; then + echo "public key file for jenkins master not exists" + exit 1 +fi + +# install required tools +sudo yum install -y java-1.8.0-openjdk +sudo yum install -y git + +# prepare disk +mkfs.ext4 ${disk_name} +mkdir /jenkins_home +mount ${disk_name} /jenkins_home + +chmod 600 ~/.ssh/authorized_keys diff --git a/ci/slave-scripts/opensuse.sh b/ci/slave-scripts/opensuse.sh new file mode 100644 index 0000000..b50ddb0 --- /dev/null +++ b/ci/slave-scripts/opensuse.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +disk_name=$1 + +if [[ ! -e ${disk_name} ]]; then + echo "disk ${disk_name} not existed" + exit 1 +fi + +if [[ ! -e ~/.ssh/authorized_keys ]]; then + echo "public key file for jenkins master not exists" + exit 1 +fi + +# install required tools +zypper install -y java-1_8_0-openjdk +zypper install -y git + +# prepare disk +mkfs.ext4 ${disk_name} +mkdir /jenkins_home +mount ${disk_name} /jenkins_home + +chmod 600 ~/.ssh/authorized_keys diff --git a/ci/slave-scripts/setup.sh b/ci/slave-scripts/setup.sh new file mode 100755 index 0000000..b4a1a0c --- /dev/null +++ b/ci/slave-scripts/setup.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +# Usage: ./setup.sh +script_name=$1 +ip_address=$2 +disk_name=$3 +scp ./authorized_keys root@${ip_address}:~/.ssh/ +scp ./${script_name} root@${ip_address}:~/ +ssh root@${ip_address} "chmod +x ~/${script_name} && ~/${script_name} ${disk_name}" \ No newline at end of file -- GitLab