From 48d30546f897c3980186b886fa0635ca47bc500e Mon Sep 17 00:00:00 2001 From: Brian Freeman Date: Tue, 20 Aug 2019 13:13:58 -0500 Subject: Ingest onap-lab-ci jjb's Issue-ID: INT-1215 Change-Id: I448fb7a147daa26d760df6c83fef75aa69f05879 Signed-off-by: Brian Freeman --- deployment/onap-lab-ci/heat/grafana/grafana.yaml | 36 +++++ .../heat/grafana/grafana_vm_config.yaml | 61 +++++++ .../heat/jenkins/jenkins_vm_config.yaml | 176 +++++++++++++++++++++ .../onap-lab-ci/heat/jenkins/lab-jenkins.yaml | 36 +++++ 4 files changed, 309 insertions(+) create mode 100644 deployment/onap-lab-ci/heat/grafana/grafana.yaml create mode 100644 deployment/onap-lab-ci/heat/grafana/grafana_vm_config.yaml create mode 100644 deployment/onap-lab-ci/heat/jenkins/jenkins_vm_config.yaml create mode 100644 deployment/onap-lab-ci/heat/jenkins/lab-jenkins.yaml (limited to 'deployment/onap-lab-ci/heat') diff --git a/deployment/onap-lab-ci/heat/grafana/grafana.yaml b/deployment/onap-lab-ci/heat/grafana/grafana.yaml new file mode 100644 index 000000000..c32342b90 --- /dev/null +++ b/deployment/onap-lab-ci/heat/grafana/grafana.yaml @@ -0,0 +1,36 @@ +heat_template_version: 2015-10-15 + +resources: + influxdb_data: + type: OS::Cinder::Volume + properties: + size: 100 + grafana: + type: OS::Nova::Server + properties: + name: grafana + image: bionic + flavor: m1.large + key_name: mykey + networks: + - network: c5ef4668-8a11-441d-8ce8-4a211a94885f + user_data_format: RAW + user_data: + str_replace: + params: + "%voldata_id%": { get_resource: influxdb_data } + template: + get_file: grafana_vm_config.yaml + influxdb_data_att: + type: OS::Cinder::VolumeAttachment + properties: + instance_uuid: { get_resource: grafana } + volume_id: { get_resource: influxdb_data } + +outputs: + instance_name: + description: Name of the instance. + value: { get_attr: [ grafana, name ] } + instance_ip: + description: IP address of the instance. + value: { get_attr: [ grafana, first_address ] } diff --git a/deployment/onap-lab-ci/heat/grafana/grafana_vm_config.yaml b/deployment/onap-lab-ci/heat/grafana/grafana_vm_config.yaml new file mode 100644 index 000000000..1151d7095 --- /dev/null +++ b/deployment/onap-lab-ci/heat/grafana/grafana_vm_config.yaml @@ -0,0 +1,61 @@ +#cloud-config +# vim: syntax=yaml +write_files: +- path: /opt/format-disks + permissions: '0700' + content: | + #!/bin/bash + voldata_id="%voldata_id%" + voldata_dev="/dev/disk/by-id/virtio-$(echo ${voldata_id} | cut -c -20)" + mkfs.ext4 ${voldata_dev} + mkdir -pv /var/lib/influxdb + echo "${voldata_dev} /var/lib/influxdb ext4 defaults 1 2" >> /etc/fstab + mount /var/lib/influxdb +- path: /opt/grafana_vm_entrypoint.sh + permissions: '0755' + content: | + #!/bin/bash -x + + printenv + + cp ~ubuntu/.ssh/authorized_keys /root/.ssh + + cat > /etc/apt/apt.conf.d/90curtin-aptproxy<> /etc/inputrc <> /etc/fstab + mount /var/lib/jenkins +- path: /opt/jenkins_vm_entrypoint.sh + permissions: '0755' + content: | + #!/bin/bash -x + + printenv + + echo `hostname -I` `hostname` >> /etc/hosts + + function restart_jenkins() { + sudo systemctl restart jenkins + sleep 1 + echo -n "Restarting jenkins" + until $(curl --output /dev/null --silent --head --fail http://localhost:8080/login); do + printf '.' + sleep 3 + done + echo + sleep 1 + } + + cp ~ubuntu/.ssh/authorized_keys /root/.ssh + + cat > /etc/apt/apt.conf.d/90curtin-aptproxy<> /etc/inputrc < /etc/apt/sources.list.d/jenkins.list' + apt-get update + apt-get -y install jenkins + + mkdir -p ~jenkins/.ssh + cp ~ubuntu/.ssh/authorized_keys ~jenkins/.ssh + chown -R jenkins:jenkins ~jenkins/.ssh + + su -l jenkins -c "/opt/jenkins-init-1.sh" + + restart_jenkins + + su -l jenkins -c "/opt/jenkins-init-2.sh" + + restart_jenkins + +- path: /opt/jenkins-init-1.sh + permissions: '0755' + content: | + #!/bin/bash -x + + git config --global user.email "jenkins@localhost" + git config --global user.name "jenkins" + + cd ~jenkins + + cp /etc/skel/.profile . + cat > .bashrc < /dev/null + + rm -f secrets/initialAdminPassword + rm -rf users/admin + rsync -avP /opt/jenkins/ . + + git add -A + git commit -m 'Set up jenkins user' > /dev/null + +- path: /opt/jenkins-init-2.sh + permissions: '0755' + content: | + #!/bin/bash -x + + cd ~jenkins + ln -s /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar + + sleep 20 + java -jar jenkins-cli.jar -s http://localhost:8080/ -auth jenkins:jenkins install-plugin git + java -jar jenkins-cli.jar -s http://localhost:8080/ -auth jenkins:jenkins install-plugin ws-cleanup + java -jar jenkins-cli.jar -s http://localhost:8080/ -auth jenkins:jenkins install-plugin envinject + java -jar jenkins-cli.jar -s http://localhost:8080/ -auth jenkins:jenkins install-plugin gerrit-trigger + java -jar jenkins-cli.jar -s http://localhost:8080/ -auth jenkins:jenkins install-plugin robot + java -jar jenkins-cli.jar -s http://localhost:8080/ -auth jenkins:jenkins install-plugin postbuildscript + java -jar jenkins-cli.jar -s http://localhost:8080/ -auth jenkins:jenkins install-plugin timestamper + java -jar jenkins-cli.jar -s http://localhost:8080/ -auth jenkins:jenkins install-plugin build-blocker-plugin + java -jar jenkins-cli.jar -s http://localhost:8080/ -auth jenkins:jenkins install-plugin build-timeout + java -jar jenkins-cli.jar -s http://localhost:8080/ -auth jenkins:jenkins install-plugin influxdb + + git add -A + git commit -m 'Install initial plugins' > /dev/null + + git clone https://github.com/garyiwu/onap-lab-ci.git + cd onap-lab-ci + jenkins-jobs update -r jjb + +- path: /opt/jenkins/jenkins.install.InstallUtil.lastExecVersion + content: | + 2.46.3 +- path: /opt/jenkins/users/jenkins/config.xml + content: | + + + jenkins + + + {AQAAABAAAAAwQAGpldGajxw//dhxd53gZGv4w0JnZYDETTLBQdpotQXt02s0lq13YrhyaytbLFMflb98hzWY9YBlDIThZt7u+Q==} + + + + + + + + + all + false + false + + + + + + default + + + + + + false + + + #jbcrypt:$2a$10$Esc9z/mnK/CQ8crgFbE3/eP1EI6pvzIHRBe3SSik7rrNt.DDftON2 + + + jenkins@localhost + + + + +runcmd: +- /opt/format-disks +- /opt/jenkins_vm_entrypoint.sh diff --git a/deployment/onap-lab-ci/heat/jenkins/lab-jenkins.yaml b/deployment/onap-lab-ci/heat/jenkins/lab-jenkins.yaml new file mode 100644 index 000000000..94fb79eee --- /dev/null +++ b/deployment/onap-lab-ci/heat/jenkins/lab-jenkins.yaml @@ -0,0 +1,36 @@ +heat_template_version: 2015-10-15 + +resources: + jenkins_data: + type: OS::Cinder::Volume + properties: + size: 400 + jenkins: + type: OS::Nova::Server + properties: + name: jenkins + image: bionic + flavor: m1.medium + key_name: mykey + networks: + - network: c5ef4668-8a11-441d-8ce8-4a211a94885f + user_data_format: RAW + user_data: + str_replace: + params: + "%voldata_id%": { get_resource: jenkins_data } + template: + get_file: jenkins_vm_config.yaml + jenkins_data_att: + type: OS::Cinder::VolumeAttachment + properties: + instance_uuid: { get_resource: jenkins } + volume_id: { get_resource: jenkins_data } + +outputs: + instance_name: + description: Name of the instance. + value: { get_attr: [ jenkins, name ] } + instance_ip: + description: IP address of the instance. + value: { get_attr: [ jenkins, first_address ] } -- cgit 1.2.3-korg