Skip to content

Instantly share code, notes, and snippets.

View firemanxbr's full-sized avatar

Marcelo Barbosa firemanxbr

View GitHub Profile
[firemanxbr@firemanxbr tmp]$ oc describe node localhost
Name: localhost
Role:
Labels: beta.kubernetes.io/arch=amd64
beta.kubernetes.io/os=linux
kubernetes.io/hostname=localhost
Annotations: volumes.kubernetes.io/controller-managed-attach-detach=true
Taints: <none>
CreationTimestamp: Wed, 09 May 2018 14:29:56 +0200
Phase:
Triggered by CI message.
Obtained triggering/Jenkinsfile from git https://gitlab.sat.lab.tlv.redhat.com/cvp/pipeline.git
Running in Durability level: MAX_SURVIVABILITY
Loading library cico-pipeline-library@master
Attempting to resolve master from remote references...
> git --version # timeout=10
> git ls-remote -h -t https://github.com/CentOS/cico-pipeline-library # timeout=10
Found match: refs/heads/master revision fbf47bf0b196e6225c76fb744050673f99461543
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
$ ansible-lint playbooks/setup.yml
WARNING: Couldn't open /home/firemanxbr/GitHub/tmp/contra-env-setup/playbooks/roles/minishift/tasks/roles/os_temps/tasks/install_oc_bin.yml - No such file or directory
WARNING: Couldn't open /home/firemanxbr/GitHub/tmp/contra-env-setup/playbooks/roles/os_temps/tasks/roles/prereqs/tasks/install_virtual_reqs.yml - No such file or directory
[ANSIBLE0012] Commands should not change things if nothing needs doing
/home/firemanxbr/GitHub/tmp/contra-env-setup/playbooks/roles/cleanup/tasks/cleanup.yml:5
Task/Handler: Stop minishift if running
[ANSIBLE0013] Use shell only when shell functionality is required
/home/firemanxbr/GitHub/tmp/contra-env-setup/playbooks/roles/cleanup/tasks/cleanup.yml:5
Task/Handler: Stop minishift if running
@firemanxbr
firemanxbr / cvp-master
Created May 7, 2018 10:57
testing CVP/pipeline on branch master
$ oc new-project cvp
Now using project "cvp" on server "https://192.168.42.181:8443".
You can add applications to this project with the 'new-app' command. For example, try:
oc new-app centos/ruby-22-centos7~https://github.com/openshift/ruby-ex.git
to build a new example application in Ruby.
$ oc create -f ./config/s2i/jenkins/jenkins-persistent-template.yml
$ oc project
Using project "cvp" on server "https://192.168.42.242:8443".
$ oc create -f ./config/s2i/jenkins/jenkins-persistent-template.yml
template "jenkins-persistent" created
$ oc create -f ./config/s2i/jenkins/jenkins-slave-template.yml
template "jenkins-cvp-slave-builder" created
$ oc new-app jenkins-persistent
[firemanxbr@firemanxbr jenkins-jobs]$ ./gradlew clean test
Download https://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/jms-messaging/1.0.36/jms-messaging-1.0.36.pom
Download https://repo.maven.apache.org/maven2/org/apache/commons/commons-lang3/3.2.1/commons-lang3-3.2.1.pom
Download https://repo.maven.apache.org/maven2/org/zeromq/jeromq-jms/1.1.2-RELEASE/jeromq-jms-1.1.2-RELEASE.pom
Download https://repo.maven.apache.org/maven2/org/codehaus/jackson/jackson-mapper-asl/1.9.13/jackson-mapper-asl-1.9.13.pom
Download https://repo.maven.apache.org/maven2/com/jayway/jsonpath/json-path/2.3.0/json-path-2.3.0.pom
Download https://repo.maven.apache.org/maven2/javax/jms/jms-api/1.1-rev-1/jms-api-1.1-rev-1.pom
Download https://repo.maven.apache.org/maven2/org/zeromq/jeromq/0.4.0/jeromq-0.4.0.pom
Download https://repo.maven.apache.org/maven2/org/apache/activemq/activemq-amqp/5.14.5/activemq-amqp-5.14.5.pom
Download https://repo.maven.apache.org/maven2/org/codehaus/jackson/jackson-core-asl/1.9.13/jackson-core-asl-1.
[firemanxbr@firemanxbr playbooks]$ ansible-lint call-sanity-tests.yml
[ANSIBLE0012] Commands should not change things if nothing needs doing
call-sanity-tests.yml:20
Task/Handler: Get VM Resource name
[ANSIBLE0010] Package installs should not use latest
call-sanity-tests.yml:31
Task/Handler: Install pre-requisites
[ANSIBLE0016] Tasks that run when changed should likely be handlers
#
# Test Command
#
$ ansible-playbook -i "localhost," trigger-and-wait-for-product-build.yml -e git_repo="NEW_git_repo" -e git_branch="NEW_git_branch" -e payload_name="NEW_payload_name" -e images="NEW_image" -e product_name="NEW_product_name" -e product_name="rhproduct" -e jenkins_url="https://jenkins-rhproduct.192.168.42.242.nip.io" -e job_name="test" -e workspace="/home/firemanxbr" -vvv
#
# Ansible-lint
#
$ ansible-lint trigger-and-wait-for-product-build.yml
[ANSIBLE0002] Trailing whitespace
@firemanxbr
firemanxbr / test-jenkins-triggering-on-jenkins-container
Created April 18, 2018 11:47
Testing to triggering the job using the curl into Jenkins CVP Master container
$ oc get pods
NAME READY STATUS RESTARTS AGE
jenkins-1-build 0/1 Completed 0 5d
jenkins-2-5l30g 1/1 Running 1 4d
jenkins-cvp-slave-1-build 0/1 Completed 0 5d
$ oc rsh jenkins-2-5l30g
sh-4.2$ curl -X POST -k -H "Authorization: Bearer `oc serviceaccounts get-token jenkins -n rhproduct`" --data-urlencode json='{"parameter": [{"name":"abc", "value":"123"}]}' https://jenkins-rhproduct.192.168.42.242.nip.io/job/test/build
node('maven') {
def productName = "rhproduct"
def url = "https://jenkins-rhproduct.192.168.42.242.nip.io"
def sa = "system:serviceaccount:${productName}:jenkins-admin".replaceAll(":", "_")
echo "${sa}"
sh 'wget https://gist.githubusercontent.com/scoheb/c960a534b592552d96265f03af52f4bf/raw/f74c5799e7c7a727ee1d42b2cfd06811ef283ac4/gistfile1.txt -O get-api-token.groovy'
sh 'curl -k --data-urlencode "script=$(< ./get-api-token.groovy)" -H "Authorization: Bearer `oc serviceaccounts get-token jenkins -n ' + productName + '`" ' + url + '/scriptText'
String apiToken = sh(