Skip to content

Instantly share code, notes, and snippets.

@jimklimov
jimklimov / gist:940742b4ed756e070095199e0335ca13
Created February 5, 2025 17:30
Exploratory Groovy to list GIT sources of MBP Jobs
Jenkins.instance.getAllItems(org.jenkinsci.plugins.workflow.job.WorkflowJob).each { def project ->
//def flow = project.getDefinition()
//println "=== ${project.fullName}" // + " => ${flow} => ${flow.getDescriptor()}"
// + " - " + project.properties
def brProp = project.getProperty(org.jenkinsci.plugins.workflow.multibranch.BranchJobProperty.class)
def br = brProp?.getBranch()
def brScm = br?.getScm()
//println " * ${brScm && brScm instanceof hudson.plugins.git.GitSCM ? brScm.getScmName() : brScm} => ${br?.getName()} => ${br?.getHead()} => ${br?.getSourceId()}"
if (brScm && brScm instanceof hudson.plugins.git.GitSCM) {
@jimklimov
jimklimov / README.md
Last active January 27, 2025 10:03
QEMU-GA on OmniOS and OpenIndiana
  • Install the qemu package which contains a .../bin/qemu-ga(OOCE Extra repo in case of OmniOS) among the server implementation
:; pkg install qemu

# On OmniOS also:
:; ln -s ../../opt/ooce/bin/qemu-ga /usr/bin
  • Edit config file; note that the method and path depend on hypervisor-provided device (virtio-agent or ISA -- without a dedicated driver package, only the latter
@jimklimov
jimklimov / jenkins-seed-job-CI-repo.groovy
Last active January 17, 2025 13:03
Quick and dirty Mother Seed Job for Jenkins pipelines
// Quick and dirty Mother Seed Job for Jenkins pipelines
// when many Jenkinsfiles live in same CI repository.
// Creates (if absent) a folder populated by multi-branch
// pipelines, each relying on its Git repo and pipeline
// filename (should be unique by naming construct below).
//
// NOTE: Needs "Job DSL plugin" installed
//
// NOTE: You will need to approve a number of method signatures
// at $JENKINS_URL/scriptApproval/ before it completes successfully.
@jimklimov
jimklimov / gist:a8dc06eacdf05eff7edc2bb69f42c0f2
Last active December 9, 2024 15:47
Jenkins SCM Changesets investigation
def b = Jenkins.instance.getItem("job-name").getBuildByNumber(1234)
println("Build name:\t${b}")
def mapCommitScm = [:]
b.getSCMs().each { scm ->
println("SCM:\t${scm}")
println("* Key:\t${scm.getKey()}")
println("* Branches:\t${scm.getBranches()}")
//println("* DN:\t${scm.getDisplayName()}")
//println("* URL:\t${scm.guessBrowser()?.repoUrl}")
@jimklimov
jimklimov / DependencyTrack-01-COMPONENTS_V.md
Last active September 25, 2024 11:37
Dependency-Track manually analyzed and/or depended-on components

PostgreSQL:

-- Helper view, indexes and methods

SET statement_timeout TO 0;

BEGIN;

-- Methods and their indices, to find UUID hits in DIRECT_DEPENDENCIES columns as text (JSON docs)

🛠 groovy scripts for jenkins credentials

... keeping update ...

@jimklimov
jimklimov / gist:4c489b7ccbd5ce89b293cea483b9f6fd
Created October 24, 2023 14:26
Jenkins - investigate job causes (e.g. to find SCM sources)
// Paste to your JENKINS_URL/script console:
def job = Jenkins.instance.getItemByFullName("org/repo/branch")
println "job: ${job}"
def build = job.getBuildByNumber(123)
println build
def commitHashForBuild(build) {
def scmAction = null
@jimklimov
jimklimov / gist:1f5f5e8b20398e70852bda6f4f0c667b
Last active September 14, 2023 01:21
Getting custom-built dotNet library+tool (2 repos)

Example below stems from my adventure starting with C#/.NET by fixing some issues in CycloneDX tooling. One big caveat was getting my custom-built library used by the custom-built tool (and VS Code IDE to debug). Ended up with the following; maybe better ways exist...

  • Install DotNet and NuGet
    • TODO: How did I get that on Windows?
    • Ubuntu Linux (in WSL):
:; sudo apt-get update && sudo apt-get install dotnet7 nuget
@jimklimov
jimklimov / gist:e6775212f6c9781173e94f5085f32fdb
Last active May 29, 2023 21:26
Cross-building exfat tools for Android on a PC

CONTEXT

TL;DR: See about installing MUSL tool-chain, and scroll down to exfatprogs build - that's what did work best for me.

Needed fsck.exfat 1.3.0 or newer to actively fix SD card issues on an Android phone. All builds I could find were older, so can only detect problems but not fix them even though these versions are supposed to be able to fix "some corruptions" (assuming exfat-fuse 1.3.0 here), e.g.:

:; which fsck.exfat
/system/bin/fsck.exfat
@jimklimov
jimklimov / backup-github.sh
Created May 11, 2023 19:08 — forked from rodw/backup-github.sh
A simple script to backup an organization's GitHub repositories, wikis and issues.
#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
#-------------------------------------------------------------------------------
# NOTES:
#-------------------------------------------------------------------------------
# * Under the heading "CONFIG" below you'll find a number of configuration
# parameters that must be personalized for your GitHub account and org.
# Replace the `<CHANGE-ME>` strings with the value described in the comments
# (or overwrite those values at run-time by providing environment variables).