docker run -it --rm --name jenkins -p '8080:8080' jenkins:alpine
- Login as Admin
- Accept the standard plugins
- Continue as Admin
- Install AnsiColor plugin
| 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 |
| 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 |
| 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() |
| pipeline { | |
| agent any | |
| stages { | |
| stage('Checkout') { | |
| options { | |
| retry(3) | |
| } | |
| steps { | |
| //Checkout new source code |
| 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:" + |
| #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' |
Type go in terminal, to verify the installation.