13 Feb 2024 | tags: age openssh
Ciphering files
We all know about multiple tools to cipher stuff, openssl, gpg, etc… Now I came across a dummy tool called age that might come in handy.
age -R ~/.ssh/id_rsa.pub <(echo hola) > lalala.age
That would use your default public key and pass a file with the contents of “echo hola”. As a result, it would generate a file called “lalala.age”.
To decript the file, you must own the private key.
age -d -i ~/.ssh/id_rsa foo.age > lalala && cat lalala
hola
16 Jan 2023 | tags: Vim
Moving around
This is a really simple post. If you want to easily view the surronding code without moving from where you’re, you can use the following shortcuts:
- CTRL-e: moves the viewport one line up
- CTRL-y: moves the viewport one line down
Really easy and convenient.
06 May 2022 | tags: Jenkins
Rationale TL;DR
We want to limit Jenkins concurrent builds, but only depending on the parameters of the job. We don’t want to block multiple instances of the same if they use different parameter values.
The solution
We all know the old good disableConcurrentBuilds()
pipeline method. It’s been here with us for ages. However, we’d like to run multiple instances of the same job when the parameters provided to them are different. In my case, I’d like to trigger a backup job over multiple machines and limit the execution only if trying to backup the same machine multiple times (i.e.: because the scheduling is not right).
There’s a nice plugin called Throttle Concurrent Builds
that might come in handy. It basically allows us to block jobs at the job/ category level. It can also supports throttling on the parameters provided, allowing us to even set the maximum number of jobs to run even using different parameters.
In my case, I used a setup like this:
options {
...
throttleJobProperty(
categories: [],
limitOneJobWithMatchingParams: true,
maxConcurrentPerNode: 0,
maxConcurrentTotal: 4,
paramsToUseForLimit: 'SYSTEM',
throttleEnabled: true,
throttleOption: 'project',
)
}
In this case, the relevant arguments in my case (remember, limit by parameter values) are:
- throttleOption: project This ought limit at the pipeline level. The other possible value is host but I’m not quite sure yet
- throttleEnabled: true This one seems self explanatory
- paramsToUseForLimit: ‘SYSTEM’ Possible parameters to use. I believe this string is a comma-separated list of parameters to use. In my case, just one parameter
- limitOneJobWithMatchingParams Apply the policy to limit one job per matching params
I got more info by checking [2]. The plugin page at [1] gives some information but I believe it could be improved.
Have fun!
[1] https://plugins.jenkins.io/throttle-concurrents/
[2] https://github.com/jenkinsci/throttle-concurrent-builds-plugin/pull/68