- in Jenkins set up a multibranch pipeline with Branch source of type
Github
(under it, set up endpoint, credentials, repo name, etc.); - in Github go to the repository Settings and add the user chosen on the previous step to the repository's colaborators;
- go to the Hooks menu and add a webhook pointing to
<your-jenkins-host>/github-webhook/
and select pull request event under Let me select individual events option; - create a pull request - after that Jenkins should automatically start a build;
- go to Branches menu under Settings and add the target branch to Protected branches;
- choose Require status checks to pass before merging and
continuous-integration/jenkins/pr-merge
under it - commit a change into the pull request and see the Jenkins build result on the page.
View Jenkinsfile
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
pipeline { | |
agent { | |
label 'Linux' | |
} | |
stages { | |
stage('ask') { | |
steps { | |
script { | |
def askpass = input( | |
message: 'Please enter the password', |
View delete_old_schemas.py
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
#!/usr/bin/env python | |
# Cleanup old schemas from schema registry | |
import httplib | |
import json | |
import re | |
DELETE_REGEX = 'IT6[0-6][0-9]-' | |
con = httplib.HTTPConnection('127.0.0.1', 8081) |
View get_compressed_url.py
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
#!/usr/bin/env python | |
# Get compressed URL content | |
import gzip | |
import StringIO | |
import urllib2 | |
req = urllib2.Request('http://my.lenses.url/api/alerts', | |
headers = { | |
'Accept-encoding': 'gzip', |
View check_srv.py
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
!/usr/bin/env python | |
# Check service availability | |
# Usage: $0 hostname port | |
import socket | |
import sys | |
if len(sys.argv) != 3: | |
sys.stderr.write("Usage: %s hostname port\n" % sys.argv[0]) | |
sys.exit(2) |
View pause_connectors.py
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
#!/usr/bin/env python | |
CONNECT_ENDPOINT = 'http://10.0.0.24:8083' | |
import httplib | |
import json | |
import os | |
import sys | |
action = 'pause' if os.path.basename(sys.argv[0]).startswith('pause') else 'resume' |
View curl_with_client_auth.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
curl --cacert /path/to/ca-root.crt \ | |
--cert /path/to/client.crt \ | |
--key /path/to/client.key \ | |
https://service.with.client.auth |
View UrlConnectTest.java
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
import java.io.*; | |
import java.net.*; | |
/** | |
* Open URL passed as the first command-line argument and read the first line from it | |
* | |
* Example usage for testing client auth: | |
* java -Djavax.net.ssl.trustStore=/path/to/truststore.jks \ | |
* -Djavax.net.ssl.trustStorePassword=myword \ | |
* -Djavax.net.ssl.keyStore=/path/to/keystore.jks \ |
View kafka-jdbc-src-reset.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
#!/bin/bash | |
echo '["my-connector-name",{"protocol":"1","table":"my_db_name.my_table_name"}]@{"incrementing":5}' | kafka-console-producer --topic _connect-offsets --broker-list 127.0.0.1:9092 --property parse.key=true --property key.separator=@ | |
# And after issuing this command, restart the connector's task (pausing/resuming the connector isn't enoght) |
View words_count.pig
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
data = load '$file' using TextLoader(); | |
tokens = foreach data generate FLATTEN(TOKENIZE($0)); | |
words = filter tokens by $0 MATCHES '[A-Za-z]+'; | |
lowers = foreach words generate LOWER($0); | |
groups = group lowers by $0; | |
counts = foreach groups generate group, COUNT(lowers.$0); | |
by_count = order counts by $1 DESC; | |
store by_count into '$file-by-count'; | |
by_word = order counts by $0 ASC; | |
store by_word into '$file-by-word'; |
View jenkinsfile_pr_check.md