Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View gianpaolof's full-sized avatar
🏍️

gianpaolo gianpaolof

🏍️
  • Italy
View GitHub Profile
@gianpaolof
gianpaolof / QuotesInJenkinsfiles.groovy
Created August 9, 2023 07:13 — forked from agarthetiger/QuotesInJenkinsfiles.groovy
Quoting strings and variable interpolation in Jenkinsfiles, passing values to shell tasks.
node{
timestamps{
stage('Samples'){
// Single quotes with no interpolation, at least not in Jenkins.
// The dollar variable will be evaluated before being run by the
// shell command, so variables which Jenkins makes available as
// environment variables can still be accessed from within a
// single-quoted string, passed to the sh task.
sh 'echo $PATH'
Useful tricks for Android gradle files
- build time
- ci_job
- dependencies
- force a lang for a specific flavor
- gcm flavorish google-services.json
- git commit count
- git sha
- isIdeBuild
@gianpaolof
gianpaolof / README.md
Created April 28, 2023 12:26 — forked from beercan1989/README.md
Retry, Continue or Abort (Jenkins Pipeline) with Colour Support

Create test Jenkins

docker run -it --rm --name jenkins -p '8080:8080' jenkins:alpine

Install

  • Login as Admin
  • Accept the standard plugins
  • Continue as Admin
  • Install AnsiColor plugin
@gianpaolof
gianpaolof / MockProxy.kt
Created April 21, 2023 10:08 — forked from rkam88/MockProxy.kt
A Java dynamic proxy that calls either the real or mocked implementation of an interface
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import java.lang.reflect.InvocationHandler
import java.lang.reflect.InvocationTargetException
import java.lang.reflect.Method
import java.lang.reflect.Proxy
import kotlin.coroutines.Continuation
import kotlin.coroutines.cancellation.CancellationException
@gianpaolof
gianpaolof / AndroidRetrofitOkHttp.kt
Created April 21, 2023 10:03 — forked from rommansabbir/AndroidRetrofitOkHttp.kt
Android : Mock Response with Retrofit & OkHttp
class LoginInterceptor: Interceptor{
override fun intercept(chain: Interceptor.Chain): Response {
//If requested endpoint matched to targeted endpoint, we will return an mocked response.
if (chain.request().url.toUri().toString().endsWith("fake-login")) {
val responseString = "OUR_JSON_RESPONSE_FROM_ASSET_OR_OTHER_SOURCE"
return chain.proceed(chain.request())
.newBuilder()
.code(200)
.protocol(Protocol.HTTP_2)
.message(responseString)
/**
* This will help us to test our networking code while a particular API is not implemented
* yet on Backend side.
*/
class MockInterceptor : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
if (BuildConfig.DEBUG) {
val uri = chain.request().url().uri().toString()
@gianpaolof
gianpaolof / Jenkinsfile
Created April 13, 2023 18:50 — forked from mikkipastel/Jenkinsfile
android jenkins pipeline
pipeline {
agent any
stages {
stage('Checkout') {
options {
retry(3)
}
steps {
//Checkout new source code
@gianpaolof
gianpaolof / Jenkinsfile
Created April 13, 2023 18:49 — forked from Schadenfeude/Jenkinsfile
Example Jenkinsfile declarative pipeline for Android projects
pipeline {
agent {
// Run on a build agent where we have the Android SDK installed
label 'android'
}
environment {
// Fastlane Environment Variables
PATH = "$HOME/.fastlane/bin:" +
"$HOME/.rvm/gems/ruby-2.5.3/bin:" +
"$HOME/.rvm/gems/ruby-2.5.3@global/bin:" +
@gianpaolof
gianpaolof / jira-curl.sh
Created March 15, 2023 19:36 — forked from TheMightyLlama/jira-curl.sh
Perform actions on a jira issue via curl
#Creates a new issue with custom fields
curl -D- -u uname:pass -X POST --data "{\"fields\": {\"project\": { \"id\": \"10430\" },\"summary\": \"This is a test issue\", \"description\": \"Description\",\"issuetype\": { \"id\" : \"1\"}, \"components\" : [{\"id\":\"10731\"}], \"customfield_10711\" : [{\"id\":\"10500\"}] } }" -H "Content-Type: application/json" http://localhost:8080/jira/rest/api/2/issue/
#Returns all information for all versions
curl -D- -u uname:pass -X PUT -d "Content-Type: application/json" http://localhost:8080/jira/rest/api/2/project/AN/versions?
#Returns all issues in a version
#This URL requires the version ID of a single version which is provided by the above query
curl -D- -u uname:pass -X PUT -d "Content-Type: application/json" http://localhost:8080/jira/rest/api/2/search?jql=project="AN"+AND+fixVersion='12345'
@gianpaolof
gianpaolof / golang_setup.md
Last active February 27, 2023 13:45 — forked from sathiyaseelan/golang_setup.md
Basics to setup a golang project repo in your local

Simple Guide to setup Golang in your Mac and clone a repo.

Setup Go and workspace

Type go in terminal, to verify the installation.

  • Create a Go workspace and set GO PATH