This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get System identification | |
uname -a | |
cat /etc/*release* | |
# Change to root (no password) | |
sudo su | |
# Packages | |
## Debian/Ubuntu | |
apt-cache search kubernetes # Search by names |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM List task and find a particular one | |
tasklist | FIND "agent.jar" | |
REM get host IP | |
ipconfig | |
REM Equivalent to "curl URL and get the output in a file" in linux | |
Invoke-WebRequest -Uri 'http://x.x.x.x:xxxx/computer/NPERMG382/slave-agent.jnlp?encrypt=true' -OutFile c:\temp\jnlp.txt | |
REM Equivalent to "cat a file passed as variable" in linux | |
type %THEFILE% | |
REM Kill Java Process |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check connection FROM Host > TO my-example.com (e.g. port 8443) | |
telnet my-example.com 8443 #It maintains a socket open to port 8443 (as example), so it can be useful to validate if there is a man a middle closing the channel Connection closed by foreign host | |
curl -IvL -X GET https://my-example.com #It also accepts to curl to a specific port e.g. https://my-example.com:8443 | |
nc -z -v -w 2 my-example.com 8443 # It will tell if the port is open or not | |
# Check if a services is running in the Host | |
sudo lsof -i -P -n | grep LISTEN # Prefered method, it provides more information including the process. For extended output use sudo | |
netstat -pnatu | grep LISTEN | |
lsof -i :50001 # Check if an application is listening to specific PORT (50001) | |
netstat -ntpl | grep 50001 # Check if an application is listening to specific PORT (50001) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################ | |
# REFERENCES: | |
#https://kubernetes.io/docs/reference/kubectl/cheatsheet/ | |
################################################################ | |
# CLUSTER | |
# CONTEXT: Locate your context and cluster | |
## List all context | |
kubectl config get-contexts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################ | |
# REFERENCES: | |
# https://helm.sh/docs/helm/ | |
################################################################ | |
# Add Repo to Helm | |
helm repo add cloudbees https://charts.cloudbees.com/public/cloudbees | |
helm repo update | |
# Search (List) for charts | |
helm search hub jenkins # in the public hub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Revert Uncommited Changes | |
git reset --hard; git clean -fd | |
# Remove branch: local and remote | |
git branch -D exampleBranch; git push origin --delete exampleBranch | |
# Checkout remote branch | |
git branch -a; git checkout origin/exampleBranch; git checkout exampleBranch | |
# Checkout remote PR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find "*<Container_ID>*" files names within the <folder-example> | |
find <folder-example> -name "*<Container_ID>*" | |
# Search on docker messages folder all the messages obteined | |
grep "level=>:error" messages | awk -F":message=>" '{print $2}' | sort | uniq -c| sort -n | |
grep "level=error" messages | awk -F":msg=" '{print $1}' | sort | uniq -c| sort -n | |
curl -u admin:*** https://example.com/example-master/ > version.html ; cat version.html | grep jenkins_ver | awk -F"jenkins_ver" '{print $2}' | awk -F"span" '{print $1}' | |
# Jenkins | |
## Getting exiting reason for a build | |
for i in $(find "${JENKINS_HOME}/jobs" -name "build.xml"); do grep -H -i "exit(" "$i"; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Docker daemon | |
## Debian/ubuntu | |
sudo service docker start | |
sudo service docker stop | |
##Centos/Redhat | |
sudo systemctl start docker | |
sudo systemctl stop docker | |
# Upload Image to DockerHub | |
## Login |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
shopt -s inherit_errexit nullglob compat"${BASH_COMPAT=42}" | |
#Parameters | |
JENKINS_USER_ID=example.user | |
JENKINS_API_TOKEN=****** | |
JENKINS_NS_LIST=("ns-example-1" "ns-example-2") | |
SLEEP_SEC=3600 |