Skip to content

Instantly share code, notes, and snippets.

@ederparaiso
ederparaiso / docker-cleanup.sh
Created May 3, 2022 21:39
docker system prune cron job with discord notification
#!/bin/sh
docker system prune --force
OUT=$?
WEBHOOK_URL="url webhook discord"
if [ $OUT = 0 ]
then
STATUS="Ok"
@ederparaiso
ederparaiso / jenkins-flow-nested-jobs.groovy
Last active January 6, 2021 12:43
Sample jenkins result examples
// https://javadoc.jenkins-ci.org/hudson/model/Result.html
/*
ABORTED - The build was manually aborted.
FAILURE - The build had a fatal error.
NOT_BUILT - The module was not built.
SUCCESS - The build had no errors.
UNSTABLE - The build had some errors but they were not fatal.
*/
pipeline {
@ederparaiso
ederparaiso / azurecr-purge-orphaned.sh
Created October 20, 2019 23:01
Purge untagged container images in Azure Container Registry
#!/bin/bash
# WARNING! This script deletes data!
# Purge untagged (orphaned) images
REGISTRY=your_registry
REPOSITORY=your_repository
az acr repository show-manifests --name $REGISTRY --repository $REPOSITORY --query "[?tags[0]==null].digest" -o tsv \
| xargs --replace=digest --verbose az acr repository delete -n $REGISTRY --image $REPOSITORY@digest --yes
@ederparaiso
ederparaiso / azurecr-purge.sh
Created October 20, 2019 21:09
Purge container images in Azure Container Registry
#!/bin/bash
# WARNING! This script deletes data!
# Purge old images retaining configured amount of tags. Tag latest will be always preserved.
REGISTRY=your_registry
REPOSITORY=your_repository
HISTORY_SIZE=amount_of_tags_to_be_remain
az acr repository show-tags -n $REGISTRY --repository $REPOSITORY --orderby time_desc --query "[?@ != 'latest'] | [$HISTORY_SIZE:]" -o tsv \
server {
listen *:80;
server_name my.nexus.url;
# and redirect to the non-www host (declared below)
return 301 https://my.nexus.url$request_uri;
}
server {
listen 443 ssl;
server_name my.nexus.url;
@ederparaiso
ederparaiso / provision-nexus.yml
Created November 27, 2018 21:10
provision nexus repository manager with ansible
- hosts: host-list
sudo: yes
tasks:
- name: "Install pip"
easy_install:
name: pip
- name: "Install docker-py"
pip:
name: docker-py
- name: "Create nexus-data dir and make it writable by the Nexus process, which runs as UID 200"
@ederparaiso
ederparaiso / provision-nginx.yml
Created November 27, 2018 21:09
provision nginx with ansible
- hosts: host-list
sudo: yes
tasks:
- name: "Add epel-release repo"
yum:
name: epel-release
state: present
- name: "Install nginx"
yum:
name: nginx
@ederparaiso
ederparaiso / provision-docker.yml
Created November 27, 2018 21:07
provision docker with ansible
- hosts: host-list
sudo: yes
tasks:
- name: "Installing Docker Prerequisite packages"
yum:
name: "{{ item }}"
state: latest
with_items:
- yum-utils
- device-mapper-persistent-data