# credentials info
USERNAME='my-username'
PASSWORD='my-clear-password'
USER_PASS="${USERNAME}:${PASSWORD}"
This file contains hidden or 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
apiVersion: v1 | |
kind: Template | |
metadata: | |
name: maven-pipeline | |
parameters: | |
- name: APP_NAME | |
description: The name assigned to all of the application objects defined in this template. | |
displayName: Application Name | |
required: true | |
value: openshift-jee-sample |
This file contains hidden or 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
## SET variable with the name of dc that you want to change | |
PROJETO=xxxx | |
# If you need a replacement a suggest you remove and them add | |
### to remove you can do this | |
oc set env dc/${PROJETO} KUBERNETES_NAMESPACE- | |
## add the deployment config with new item | |
oc patch dc/${PROJETO} --type=json --patch ' |
This file contains hidden or 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
GITLAB_TOKEN='nuXXPQyGMmCNwWnsVlm3' | |
GITLAB_BASE_URL='https://www.example.com.br/repo' | |
## <YOUR-NAMESPACE>%2F<YOUR-PROJECT-NAME> --> %2F is / url-encoded | |
GITLAB_PROJECT_NAME='codigo%2Fmoodle-php' | |
# get project by name | |
PROJECT_ID=$(curl -XGET -H "Content-Type: application/json" \ | |
-H "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \ | |
${GITLAB_BASE_URL}/api/v4/projects/${GITLAB_PROJECT_NAME} | jq '.id') |
This file contains hidden or 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
# variables - credentials info | |
USERNAME='my-username' | |
PASSWORD='my-clear-password' | |
USER_PASS="${USERNAME}:${PASSWORD}" | |
# variables - jenkins project and roles | |
TYPE='projectRoles' | |
## example of jenkins permission required to execute the Jenkins Job | |
PERMISSIONIDS='hudson.model.Item.Read,hudson.model.Item.Build' | |
ROLENAME='my-rolename' |
This file contains hidden or 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
# associate variable to a personal file location (here use a personal file location like roger-admin) | |
export KUBECONFIG=$PWD/my-kubeconfig-admin | |
# create the unique/personal local file | |
touch $KUBECONFIG | |
# then make login as usual | |
oc login <host> -u <username> -p <pass> | |
# teste it |
This file contains hidden or 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
#!/usr/bin/env groovy | |
def echos(def s ){ | |
def stage = "[${env.STAGE_NAME}]" | |
if (stage == "[null]") { | |
stage = "" | |
} | |
println "${stage}${s}" | |
} |
This file contains hidden or 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
/** | |
* @param args.APP_NAME | |
* @param args.APP_TYPE | |
* @param args.ENVIRONMENT | |
* @param args.OCP_KIND | |
*/ | |
private void setObjectLabels(Map args) { | |
echo "[setObjectLabels][init] args: ${args}" | |
openshift.raw("label", "${args.OCP_KIND}", "${args.APP_NAME}", "app=${args.APP_NAME}", "--overwrite") | |
openshift.raw("label", "${args.OCP_KIND}", "${args.APP_NAME}", "imagem=${args.APP_TYPE}", "--overwrite") |
This file contains hidden or 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
def OPS_GROUP = 'test-grup-devops' | |
def userInput = input(id: 'proceed_prd', | |
message: "Deploy em Produção? Permitido apenas para '${OPS_GROUP}'", | |
submitter: "${OPS_GROUP}", | |
parameters: [string(defaultValue: '1', | |
description: 'Número de instâncias de containers a ser provisionado', | |
name: 'containers'), | |
booleanParam(defaultValue: true, | |
description: 'Confirma se deve realizar deployment neste ambiente. Limpar caso queira evitar deploy neste ambiente.', |
This file contains hidden or 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
def waitDeploy(Map args) { | |
echos "[waitDeploy]: args ${args}" | |
if (!args.SLEEP) { | |
args.SLEEP = 10 | |
} | |
if (!args.TIMEOUT) { | |
args.TIMEOUT = 10 | |
} | |
openshift.withCluster() { | |
openshift.withProject("${args.OCP_NAMESPACE}") { |
OlderNewer