Skip to content

Instantly share code, notes, and snippets.

View fabiojose's full-sized avatar
🎯
Focusing

Fabio Jose fabiojose

🎯
Focusing
  • São Paulo, Brazil
  • 14:01 (UTC -03:00)
View GitHub Profile
@fabiojose
fabiojose / package.tf
Created November 13, 2017 15:14
Immutable Infrastructure with Terraform & Openshift - package.tf
{
"variable": {
"acronym": {
"default": "oss"
},
"project": {
"default": "opensource"
},
@fabiojose
fabiojose / rundeck-exec-follow.sh
Last active July 13, 2021 19:27
Trigger & Follow the Rundeck Job Execution using the RESTful API
#!/bin/bash
######
# Shell script to trigger and follow the rundeck job execution.
# Author: Fàbio José de Moraes
# E-mail: fabiojose@gmail.com
######
######
# Necessary environment variables
@fabiojose
fabiojose / Jenkinsfile
Last active June 25, 2023 11:25
Sample Jenkinsfile to build, test and deploy Platform-as-Code in Openshift
pipeline {
/* run in any agent (a.k.a. node executor) */
agent any
stages {
stage('Setup') {
steps {
script {
/* Check the GIT_BRANCH to compute the target environment */
if (env.GIT_BRANCH == 'origin/develop' || env.GIT_BRANCH ==~ /(.+)feature-(.+)/) {
@fabiojose
fabiojose / replication-controller.feature
Last active November 22, 2017 19:25
Feature wrote in Gherkin
Feature: Replication Controller
As a user of Openshift PaaS
I want to query Pods managed by a replication controller
So I will get all of then running and with a right setup
Scenario: All pods are running
Given I am logged in Openshift as "developer"
And access to "oss-pre" namespace
When query the pods of "apigateway" replication controller
Then all pods managed by "apigateway" replication controller should have the status equals to "running"
@fabiojose
fabiojose / replication-controller.js
Last active November 22, 2017 19:35
Steps implementation for cucumber.js
const defineSupportCode = require("cucumber").defineSupportCode;
let exec = require("child_process").exec;
let fs = require("fs");
let openshift_password = process.env.OPENSHIFT_PASSWORD || "developer";
let openshift_url = process.env.OPENSHIFT_URL || "https://127.0.0.1:8443";
let build_id = process.env.BUILD_NUMBER || "1";
let build_name = process.env.JOB_NAME || "cucumber";
@fabiojose
fabiojose / move.sh
Created December 19, 2017 11:38
Git move repo to another
git clone --mirror <URL to my OLD repo location>
cd <New directory where your OLD repo was cloned>
git remote set-url origin <URL to my NEW repo location>
git push -f origin
@fabiojose
fabiojose / nifi_merge_json.groovy
Last active March 6, 2018 19:12
Apache NIFI - ExecuteScript - Merge JSON
import org.apache.nifi.processor.FlowFileFilter
import groovy.json.JsonSlurper
import groovy.json.JsonBuilder
//get first flow file
def ff0 = session.get()
if(!ff0)return
//get project_name
def project_name = ff0.getAttribute('project_name')
@fabiojose
fabiojose / Jenkinsfile.groovy
Created March 16, 2018 12:48
Jenkinsfile fragment to send metrics to InfluxDB
script {
/* Custom data map for InfluxDB */
def custom = [:]
custom['branch'] = env.GIT_BRANCH
custom['environment'] = target /*Target environment: DEV | PRE | PRO*/
custom['part'] = 'jenkins'
custom['version'] = version /*Package version*/
/* Push metrics to InfluxDB, including all default and the custom data*/
step([$class: 'InfluxDbPublisher', customData: custom, target: 'devops-kpi'])
@fabiojose
fabiojose / git.sh
Created March 27, 2018 20:06
git special commands
# Shows the last commit stats
git show -1 --stat
#OR
git log -1 --stat
# Shows all commit stats
git log -1 --stat
# Shows for the last commmit just the stats per file
git log -1 --numstat --format='%H'
@fabiojose
fabiojose / gitlog.json
Created April 1, 2018 14:55
git log in json
[
{
"hash":"10ef79ff1720aa5179373871ee58b08674e5c420",
"author":"Fábio J. Moraes",
"email":"fabiojose@gmail.com",
"timestamp":"1510082724",
"changes":"4",
"insertions":"38",
"deletions":"15"
},