-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
George Adams
committed
Feb 9, 2018
1 parent
fe59b83
commit 5939bfb
Showing
8 changed files
with
91 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
.idea/* | ||
ansible/playbooks/*.retry | ||
*.pyc | ||
ansible/host_vars/* | ||
ansible/host_vars | ||
hosts |
7 changes: 7 additions & 0 deletions
7
ansible/playbooks/AdoptOpenJDK_Unix_Playbook/group_vars/build/adoptopenjdk_variables.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
########################## | ||
# adoptopenjdk_variables # | ||
########################## | ||
|
||
# jenkins domain | ||
Jenkins_Domain: ci.adoptopenjdk.net |
7 changes: 7 additions & 0 deletions
7
ansible/playbooks/AdoptOpenJDK_Unix_Playbook/group_vars/jck/adoptopenjdk_variables.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
########################## | ||
# adoptopenjdk_variables # | ||
########################## | ||
|
||
# jenkins domain | ||
Jenkins_Domain: ci-jck.adoptopenjdk.net |
7 changes: 7 additions & 0 deletions
7
ansible/playbooks/AdoptOpenJDK_Unix_Playbook/group_vars/test/adoptopenjdk_variables.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
########################## | ||
# adoptopenjdk_variables # | ||
########################## | ||
|
||
# jenkins domain | ||
Jenkins_Domain: ci.adoptopenjdk.net |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
- Debug | ||
- Common | ||
- Jenkins_User | ||
- Jenkins_Master | ||
- Ant-Contrib | ||
- ccache | ||
- GIT_Source | ||
|
48 changes: 48 additions & 0 deletions
48
...AdoptOpenJDK_Unix_Playbook/roles/Jenkins_Master/Supporting_Scripts/jenkins-create-node.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash -x | ||
|
||
JENKINS_URL='http://localhost:8080' | ||
NODE_NAME=$1 | ||
NODE_IP=$2 | ||
NODE_SLAVE_HOME=$3 | ||
EXECUTORS=1 | ||
SSH_PORT=22 | ||
CRED_ID='b8101a03-36e8-4687-a722-d48ad48acd5c' | ||
LABELS=`echo $4 | tr ',' ' '` | ||
USERID='jenkins' | ||
|
||
cat <<EOF | java -jar ~/bin/jenkins-cli.jar -s ${JENKINS_URL} -ssh -user admin create-node ${NODE_NAME} | ||
<slave> | ||
<name>${NODE_NAME}</name> | ||
<description></description> | ||
<remoteFS>${NODE_SLAVE_HOME}</remoteFS> | ||
<numExecutors>${EXECUTORS}</numExecutors> | ||
<mode>NORMAL</mode> | ||
<retentionStrategy class="hudson.slaves.RetentionStrategy$Always"/> | ||
<launcher class="hudson.plugins.sshslaves.SSHLauncher" plugin="[email protected]"> | ||
<host>${NODE_IP}</host> | ||
<port>${SSH_PORT}</port> | ||
<credentialsId>${CRED_ID}</credentialsId> | ||
</launcher> | ||
<label>${LABELS}</label> | ||
<nodeProperties> | ||
<hudson.slaves.EnvironmentVariablesNodeProperty> | ||
<envVars serialization="custom"> | ||
<unserializable-parents/> | ||
<tree-map> | ||
<default> | ||
<comparator class="hudson.util.CaseInsensitiveComparator"/> | ||
</default> | ||
<int>3</int> | ||
<string>JDK7_BOOT_DIR</string> | ||
<string>/usr/lib/jvm/java-1.7.0-openjdk-amd64/</string> | ||
<string>JDK8_BOOT_DIR</string> | ||
<string>/usr/lib/jvm/java-1.8.0-openjdk-amd64/</string> | ||
<string>JDK9_BOOT_DIR</string> | ||
<string>/usr/lib/jvm/java-9-openjdk-amd64/</string> | ||
</tree-map> | ||
</envVars> | ||
</hudson.slaves.EnvironmentVariablesNodeProperty> | ||
</nodeProperties> | ||
<userId>${USERID}</userId> | ||
</slave> | ||
EOF |
18 changes: 18 additions & 0 deletions
18
ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Jenkins_Master/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
################## | ||
# Jenkins_Master # | ||
################## | ||
- name: Check if machine exists in jenkins | ||
uri: | ||
url: "https://{{ Jenkins_Domain }}/computer/{{ ansible_hostname }}/api/json" | ||
register: jenkins | ||
ignore_errors: true | ||
tags: jenkins_master | ||
|
||
- name: SSH into the Jenkins and excute the jenkins-create-node.sh script | ||
become: false | ||
# TODO fetch a var instead of hard coding linux | ||
local_action: command ssh -o StrictHostKeyChecking=no {{ Jenkins_Username }}@{{ Jenkins_Domain }} "/home/{{ Jenkins_Username }}/.jenkins/jenkins-create-node.sh {{ inventory_hostname }} {{ ansible_host }} /home/jenkins linux,{{os}},{{arch}},{{provider}},{{ansible_architecture}},{{type}},{{ansible_distribution|lower}},{{ansible_distribution|lower}}{{ansible_distribution_major_version}}" | ||
when: | ||
- jenkins.status != 200 | ||
tags: jenkins_master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters