Skip to content

Instantly share code, notes, and snippets.

@yarinkos
yarinkos / gist:c943d4174f68957b4c110c0ea6d3ed2a
Created January 22, 2019 09:30
RestTemplate request (basic auth )
RestTemplate restTemplate = new RestTemplate();
restTemplate.getInterceptors().add(
new BasicAuthorizationInterceptor("user", "password"));
String url = "YOUR_URL";
ResponseEntity<String> response = null;
try {
response = restTemplate.exchange(url,
HttpMethod.GET, null, String.class);
@yarinkos
yarinkos / version.upgrade
Created August 7, 2018 07:51
groovy version upgrade
version='1.0.11.1001'
// task incrementrevsion{
def v = version
println v
String minor=v.substring(v.lastIndexOf('.')+1) //get last digit
int m=minor.toInteger()+1 //increment
// println m
String major=v.substring(0,v.lastIndexOf(".")); //get the beginning
@yarinkos
yarinkos / pipeline.sh
Created July 5, 2018 09:29
Simple git clone commit ,update version and push
pipeline {
agent {
node {
label 'label'
}
}
stages {
stage('checkout git') {
steps {
git credentialsId: 'ae31c482-72fc-****-8c81-662daa51f408', url: 'https://github.com/****/complicated_hello_world.git'
@yarinkos
yarinkos / gist:97161a048331e1d4ba959380a03439ce
Last active June 18, 2018 14:35
Get param from env var after setting by script pipeline
//tmp.sh export foo=bar
getFoo = " "
pipeline {
environment {
a="d"
// b="changeable"
}
@yarinkos
yarinkos / installAndConfigJava.sh
Created February 1, 2018 10:24
Java 8 installation Centos 7
#!/bin/bash
cd /opt/
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161-linux-x64.tar.gz"
tar xzf jdk-8u161-linux-x64.tar.gz
echo 'export JAVA_HOME=/opt/jdk1.8.0_161
export JRE_HOME=/opt/jdk1.8.0_161/jre
export PATH=$PATH:/opt/jdk1.8.0_161/bin:/opt/jdk1.8.0_161/jre/bin' >> /etc/environment
@yarinkos
yarinkos / setting.xml
Created September 28, 2016 17:57
for nexus upload
<settings>
<servers>
<server>
<id>nexus</id>
<username>user</username>
<password>user123</password>
</server>
</servers>
</settings>
@yarinkos
yarinkos / deploy_to_nexus
Last active September 28, 2016 17:56
deploy to nexus with setting.xml
mvn -s settings.xml deploy:deploy-file -Durl=http://nexus3:8081/repository/thirdparty/
-DrepositoryId=nexus -Dfile=file.jar -DgroupId=groupId -DartifactId=artifactId -Dversion=version
@yarinkos
yarinkos / gist:43995985136969fa9c664ab4a7ff8b3b
Last active September 28, 2016 15:52
upload archive to nexus
#!/bin/sh
SERVER=$1
GROUPID=$2
ARTIFACTID=$3
VERSION=$4
USER=$5
FILENAME=$6
REPO=$7
URL="$SERVER/nexus/service/local/artifact/maven/content"