Skip to content

Instantly share code, notes, and snippets.

View daniilyar's full-sized avatar
💭
Build systems for people, not only for money

Daniil Yaroslavtsev daniilyar

💭
Build systems for people, not only for money
View GitHub Profile
@daniilyar
daniilyar / find_unused_jobs.groovy
Last active January 2, 2024 06:24
Jenkins Groovy script to find unused jobs. Unused means 'not built for more than X days'
import jenkins.model.Jenkins
import jenkins.model.JenkinsLocationConfiguration
String jobNameRegexp = ".*"
long maxThresholdDays = 60; // days
boolean ignoreDisabledJobs = true
def getLastBuildTime(Job job) {
def lastBuild = job.getLastBuild()
if(lastBuild == null) {
@daniilyar
daniilyar / ecr_secrets_refresher.sh
Created May 16, 2019 09:45
AWS ECR token refresh script
#!/bin/bash
HELP_MSG="This script read the AWS credentials from the execution environment and does the docker-login via the AWS-CLI utility.\n
Available arguments: '-s' for the name of the ECR secret will add, '-p' for the profile, '-h' for this message."
while getopts :r:p:h: option
do
case "${option}"
in
r) AWS_REGION="$OPTARG";;
@daniilyar
daniilyar / ecr_secrets_refresher.sh
Last active June 1, 2019 01:26
Script for refreshing the ECR secret in all Kubernetes namespaces
#!/bin/bash
HELP_MSG="This script read the AWS credentials from the execution environment, get the docker-login scring by the AWS-CLI utility, creates the k8s secret with
this docker-login and add it as a a part of "imagePullSecrets" option to the 'default' serviceaccounts in all k8s namespaces.\n
Available arguments: '-s' for the name of the ECR secret will add, '-p' for the patchstring, '-h' for this message."
while getopts :r:p:s:a:h: option
do
case "${option}"
in
@daniilyar
daniilyar / script.groovy
Last active December 20, 2022 04:05
Jenkins groovy script: get all builds started during a specific time
// This example lists all job that were started on Jul 16, 2019 between 1:20 PM and 2:30 PM
String df = 'MMM dd, yyyy h:mm a'
long startTimestamp = Date.parse(df, 'Jul 16, 2019 1:20 PM').getTime()
long endTimestamp = Date.parse(df, 'Jul 16, 2019 2:30 PM').getTime()
Jenkins.instance.getAllItems(AbstractItem.class).each {
builds = it.getBuilds().byTimestamp(startTimestamp, endTimestamp)
if(!builds.isEmpty()) {
@daniilyar
daniilyar / BOINC_Rosetta_home_Ubuntu_18
Last active September 28, 2021 10:33
How to install BOINC and start calculating for Rosetta@home (Ubuntu 18)
# Before you start: register at Rosetta website (http://boinc.bakerlab.org/rosetta/join.php) and remember your registration email and password
sudo -i
# install dependencies:
apt -qqy update && apt install -y --auto-remove libsm6 libxext6 libnotify-bin libcurl3 && apt -qqy clean
# Install BOINC:
cd /opt
wget -q https://boinc.berkeley.edu/dl/boinc_7.4.22_x86_64-pc-linux-gnu.sh -O boinc.sh
@daniilyar
daniilyar / Dockerfile
Created May 6, 2020 15:59
Docker Ubuntu 18.04 image with Python 3.7
FROM ubuntu:18.04
# There is no official Ubuntu-18-based image for Python in Вocker Hub.
# But using Ubuntu 18 as a base (for everything that can't run in Alpine) is a requirement from SEC team.
# So we compile Python into Ubuntu-18 image ourselves
ENV PYTHON_VERSION 3.7.7
ENV PYTHON_PIP_VERSION 20.1
ENV DEBIAN_FRONTEND=noninteractive