Skip to content

Instantly share code, notes, and snippets.

View cccaternberg's full-sized avatar
🎯
Focusing

Andreas Caternberg cccaternberg

🎯
Focusing
View GitHub Profile
kops edit --help
kops edit ig --name $NAME nodes
# Change `spec.maxSize` and `spec.minSize` to `2`, save, and exit.
kops update cluster --name $NAME --yes
kops validate cluster
source kops
export BUCKET_NAME=devops23-$(date +%s)
export KOPS_STATE_STORE=s3://$BUCKET_NAME
aws s3api create-bucket \
--bucket $BUCKET_NAME \
--create-bucket-configuration \
LocationConstraint=$AWS_DEFAULT_REGION
/*
Set yourself up:
1) Install SDKMAN - http://sdkman.io/
2) Install Groovy: sdk install groovy
3) Start the groovy console by typing: groovyConsole
*/
// Single line comments start with two forward slashes
#create the cluster
##These include Jenkins a CI/CD pipeline solution
##Nexus - an artifact repository
##Chartmuseum - a Helm Chart repository
##Monocular which provides a Web UI for searching and discovering charts deployed into your cluster via Jenkins X.
#jx create cluster gke --cluster-name='jx-acaternberg' --labels='created-by-acaternberg'
#jx create cluster gke --skip-login --default-admin-password=mySecretPassWord123 -n jx-acaternberg
jx create cluster gke
#create a spring-boot application
@cccaternberg
cccaternberg / nexus_upload.sh
Created October 11, 2018 12:09 — forked from jbaranski/nexus_upload.sh
Artifact upload to nexus using curl
# nexus 2.x
# Assuming you run this command against the directory the jar sits in
#
# r - repository
# hasPom - whether you are supplying the pom or you want one generated. If generated g, a, v, p, and c are not needed
# e - extension
# g - group id
# a - artifact id
# v - version
# p - packaging
@cccaternberg
cccaternberg / DSLBitbucket.groovy
Created October 22, 2018 12:29
Bitbucket from Groovy
#!groovy
/**
API Base URL - by default it’s https://bitbucket.org/api
API Version - 1.0 or 2.0
API Endpoint Path - includes the following
“repositories” - since we want to use one of the repositories API
Organization Name - aka team or account name
Repository Name - repository slug
Repositories API Endpoint - branches since we want to get list of branches
*/
######################
# Create The Cluster #
######################
az login
az provider register -n Microsoft.Network
az provider register -n Microsoft.Storage
see https://jfrog.com/knowledge-base/how-to-configure-artifactory-as-an-internal-jenkins-update-site/
* Create a remote repo named Jenkins-update
* Create a local repo named jenkins-update-center
* Get the update-center.json from repo Jenkins-update to local and modify the URL from 'http://updates.jenkins-ci.org/' to my own URL 'https://artifacts.xxx.com/artifactory/Jenkins-update/' in update-center.json, then put update-center.json into local repo.
```
#!/bin/sh
curl -L -o /tmp/update-center.json http://localhost:8081/artifactory/Jenkins-update-cache/update-center.json
sed -i 's#http://updates.jenkins-ci.org/#https://artifacts.xxx.com/artifactory/Jenkins-update/#g' /tmp/update-center.json
#create the cluster
jx create cluster eks -n $CLUSTER_NAME \
--default-admin-password admin123!
These include #
-> Jenkins as CI/CD pipeline solution
-> Nexus - an artifact repository
-> Chartmuseum - a Helm Chart repository
-> Monocular which provides a Web UI for searching and discovering charts deployed into your cluster via Jenkins X.
@cccaternberg
cccaternberg / Prtintcreds
Created August 26, 2019 08:38
Groovy-printallcredentials
import com.cloudbees.plugins.credentials.CredentialsProvider
import com.cloudbees.plugins.credentials.Credentials
import com.cloudbees.plugins.credentials.domains.Domain
import jenkins.model.Jenkins
def indent = { String text, int indentationCount ->
def replacement = "\t" * indentationCount
text.replaceAll("(?m)^", replacement)
}
Jenkins.get().allItems().collectMany{ CredentialsProvider.lookupStores(it).toList()}.unique().forEach { store ->