My collection of useful hints and snippets for the Jenkins Pipeline Plugin
- Check this repository
My collection of useful hints and snippets for the Jenkins Pipeline Plugin
| // Check if a slave has < 10 GB of free space, wipe out workspaces if it does | |
| import hudson.model.*; | |
| import hudson.util.*; | |
| import jenkins.model.*; | |
| import hudson.FilePath.FileCallable; | |
| import hudson.slaves.OfflineCause; | |
| import hudson.node_monitors.*; | |
| for (node in Jenkins.instance.nodes) { |
These are some simple bash functions and scripts for making CSV/TSV files prettier on the command line
see http://stefaanlippens.net/pretty-csv.html for more information.
| # | |
| # Copyright (C) 2013 Vinay Sajip. New BSD License. | |
| # | |
| import os | |
| import os.path | |
| from subprocess import Popen, PIPE | |
| import sys | |
| from threading import Thread | |
| from urllib.parse import urlparse | |
| from urllib.request import urlretrieve |
| #!/bin/bash | |
| ##################################################### | |
| # Name: Bash CheatSheet for Mac OSX | |
| # | |
| # A little overlook of the Bash basics | |
| # | |
| # Usage: | |
| # | |
| # Author: J. Le Coupanec | |
| # Date: 2014/11/04 |
| #!/bin/bash | |
| # This script should be located on each Jenkins slave, and the jenkins user should have permission to run it with sudo | |
| # Attempts to cleanly stop and remove all containers, volumes and images. | |
| docker ps -q | xargs --no-run-if-empty docker stop | |
| docker ps -q -a | xargs --no-run-if-empty docker rm --force --volumes | |
| docker volume ls -q | xargs --no-run-if-empty docker volume rm | |
| docker images -a -q | xargs --no-run-if-empty docker rmi -f | |
| # Stops the docker service, unmounts all docker-related mounts, removes the entire docker directory, and starts docker again. |
| node("${params.BUILD_AGENT}") { | |
| stage('Dangling Containers') { | |
| sh 'docker ps -q -f status=exited | xargs --no-run-if-empty docker rm' | |
| } | |
| stage('Dangling Images') { | |
| sh 'docker images -q -f dangling=true | xargs --no-run-if-empty docker rmi' | |
| } | |
If you've built ffmpeg as instructed here on Linux and the ffmpeg binary is in your path, you can do fast HEVC encodes as shown below, using NVIDIA's NPP's libraries to vastly speed up the process.
Now, to do a simple NVENC encode in 1080p, (that will even work for Maxwell Gen 2 (GM200x) series), start with:
ffmpeg -i <inputfile> \
-filter:v scale_npp=w=1920:h=1080:format=nv12:interp_algo=lanczos \
-c:v hevc_nvenc -profile main -preset slow -rc vbr_hq \
| Encoder hevc_nvenc [NVIDIA NVENC hevc encoder]: | |
| General capabilities: delay | |
| Threading capabilities: none | |
| Supported pixel formats: yuv420p nv12 p010le yuv444p yuv444p16le bgr0 rgb0 cuda d3d11 | |
| hevc_nvenc AVOptions: | |
| -preset <int> E..V.... Set the encoding preset (from 0 to 11) (default medium) | |
| default E..V.... | |
| slow E..V.... hq 2 passes | |
| medium E..V.... hq 1 pass | |
| fast E..V.... hp 1 pass |