Skip to content

Instantly share code, notes, and snippets.

@solvingj
solvingj / jenkins.yaml
Last active Jul 10, 2020
Jenkins CASC for organization folder: Whats wrong?
View jenkins.yaml
jobs:
- script: >
organizationFolder('gitbucket') {
description("All repos with Jenkinsfiles discovered on gitbucket")
displayName("gitbucket")
organizations {
github {
apiUri("http://gitbucket/api/v3")
credentialsId('DEMO_GIT_CREDS')
repoOwner('root')
View gist:87851300eb97e5aaab524d3e12eee956
package demo.ci.arg
import com.lesfurets.jenkins.unit.declarative.DeclarativePipelineTest
import org.junit.Before
import org.junit.jupiter.api.Test
import static com.lesfurets.jenkins.unit.global.lib.LibraryConfiguration.library
import static com.lesfurets.jenkins.unit.global.lib.ProjectSource.projectSource
class ConanArgsJPUSpec extends DeclarativePipelineTest {
@Override
@solvingj
solvingj / withIndex.txt
Last active Jun 14, 2020
Iterable withIndex behavior discrepancy on Jenkins
View withIndex.txt
// Run this in a Jenkins step
String jsonStr = "['zero', 'one', 'two']"
JSONArray jsonArray = new JsonSlurper().parseText(jsonStr) as JSONArray
jsonArray.withIndex().each{Object str, Integer idx -> currentBuild.echo("${idx.toString()} : ${str}")}
// OUTPUT from jenkins
// [Pipeline] echo
// null : [zero, 0]
// [Pipeline] echo
// null : [one, 1]
View failing block...
jobs:
- script: >
multibranchPipelineJob('libA') {
branchSources {
git {
id = 'libA'
credentialsId = 'GIT_CREDS'
remote('http://172.17.0.3:8080/git/root/libA.git')
}
}
@solvingj
solvingj / job.log
Created May 7, 2020
casc job first run failure stacktrace
View job.log
ranch indexing
> /usr/local/bin/git rev-parse --is-inside-work-tree # timeout=10
ERROR: Workspace has a .git repository, but it appears to be corrupt.
hudson.plugins.git.GitException: Error performing git command: /usr/local/bin/git rev-parse --is-inside-work-tree
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2437)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2360)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2356)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1916)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1928)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.hasGitRepo(CliGitAPIImpl.java:343)
@solvingj
solvingj / CpsScriptMock.groovy
Created May 6, 2020
Extending CpsScript Impossible?
View CpsScriptMock.groovy
// Fails to compile with:
// CpsScriptMock.java:15: error: unreported exception IOException; must be caught or declared to be thrown
// But i'm throwing it right?
package demo.ci
import org.jenkinsci.plugins.workflow.cps.CpsScript
class CpsScriptMock extends CpsScript {
CpsScriptMock() throws IOException {
}
@solvingj
solvingj / tasks.vs.json
Last active Jun 20, 2019
Current Schema of Tasks.vs.json
View tasks.vs.json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"default": {
"type": "object",
"properties": {
"taskName": {
"type": "string"
},
"taskLabel": {
View gist:db4a7a4558744b9355555fe45f3f09e2
Updating makefiles....
Considering target file 'Makefile'.
Looking for an implicit rule for 'Makefile'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.o'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.c'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.cc'.
Trying pattern rule with stem 'Makefile'.
@solvingj
solvingj / embeddable-python-layout-and-log.txt
Last active May 2, 2019
embeddable-python-layout-and-log
View embeddable-python-layout-and-log.txt
user@user-laptop:~/tmp$ ls -l
total 32300
-rwxrwxrwx 1 user user 58312 May 2 14:21 _asyncio.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 12648 May 2 14:21 _bisect.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 46528 May 2 14:21 _blake2.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 149880 May 2 14:21 _codecs_cn.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 158104 May 2 14:21 _codecs_hk.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 27000 May 2 14:21 _codecs_iso2022.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 264568 May 2 14:21 _codecs_jp.cpython-36-x86_64-linux-gnu.so
-rwxrwxrwx 1 user user 137592 May 2 14:21 _codecs_kr.cpython-36-x86_64-linux-gnu.so
@solvingj
solvingj / README.md
Last active Feb 23, 2019
Future Readme of DAG-Build (WIP) Jenkins plugin
View README.md

Preface
DAG stands for Directed Acyclic Graph . This term is commonly used in software development when discussing dependency trees. In the context of Jenkins, "DAG Build" provides the necessary logic to calculate a DAG out of the existing Jenkins Dependency Graph defined in Jenkins projects for each build.

DAG Build Feature Summary
The DAG Build plugin builds adds automatic enforcement of a correct, coherent, ordered, and linear execution of a dependency graph, with support for complex fork and join scenarios. Notably, it works with both "Upstream" and "Downstream" build triggers. Historically, other strategies and mechanisms have enforced this type of deliberate, coordinated build logic within Jenkins, however they all have dramatically different designs, and thus have different characteristics.

Motivation
This plugin is particularly relevant for Jenkins deployments with complex build dependency graphs featuring "diamond dependency" scenarios. Abstractly, a diamond dependency is one

You can’t perform that action at this time.