Skip to content

Instantly share code, notes, and snippets.

View lcarva's full-sized avatar

Luiz Carvalho lcarva

  • Red Hat, Inc.
  • Eastern US
View GitHub Profile
@lcarva
lcarva / chains-kind-create.sh
Created June 11, 2024 12:07
Tekton Chains on a Kind cluster
#!/bin/bash
set -euo pipefail
# Start from a clean slate
kind delete cluster
# Start a new kind cluster
# kind create cluster --image kindest/node:v1.24.13
kind create cluster
@lcarva
lcarva / check-it.sh
Last active February 6, 2024 15:06
Check if image defines a unique label from parent
#!/bin/bash
set -euo pipefail
function debug() {
>&2 echo "DEBUG: ${1}"
}
function get_labels() {
skopeo inspect --no-tags --config "docker://${1}" | jq '.config.Labels'
@lcarva
lcarva / gcl.sh
Last active January 17, 2024 17:35
Display the Global Component List for an application in Konflux
#!/bin/bash
set -euo pipefail
APPLICATION=$1
echo "Global Component List for ${APPLICATION} application"
components="$(oc get component -o json | \
jq '.items[] | select(.spec.application == "'${APPLICATION}'") | "\(.metadata.name);\(.spec.containerImage)"' -r)"
@lcarva
lcarva / random-name.sh
Created December 15, 2023 19:06
random-name
#!/bin/bash
set -euo pipefail
# Based on https://github.com/moby/moby/blob/master/pkg/namesgenerator/names-generator.go
adjectives=(
"admiring"
"adoring"
"affectionate"
"agitated"
package blobby
import future.keywords.contains
import future.keywords.if
import future.keywords.in
# METADATA
# title: Fetch Blob
# description: Just a fetch blob from the OCI registry.
@lcarva
lcarva / chains-kind-create.sh
Last active August 18, 2023 13:07
Spin up Tekton Pipeline and Tekton Chains
#!/bin/bash
set -euo pipefail
# Start from a clean slate
kind delete cluster
# Start a new kind cluster
# kind create cluster --image kindest/node:v1.24.13
kind create cluster
@lcarva
lcarva / kubectl-new-env
Last active October 31, 2022 20:13
Easily create a new temporary kubeconfig
#!/bin/bash
# Create a new temporary kubeconfig file and display a command to
# configure the current shell to use the new kubeconfig file.
# This is helpful if you interact with multiple OpenShift clusters
# at the same time.
#
# Usage:
# $(kubectl-new-env)
set -euo pipefail
@lcarva
lcarva / jira_issue_url_handler.py
Created August 27, 2019 12:50
Terminator plugin to turn JIRA issue identifiers into a link
from terminatorlib import config, plugin
AVAILABLE = ['JiraIssueURLHandler']
DEFAULT_JIRA_URL = 'https://jira.atlassian.com/browse'
DEFAULT_MATCH = '[A-Z0-9]{3,}-[0-9]{3,}'
class JiraIssueURLHandler(plugin.URLHandler):
capabilities = ['url_handler']
handler_name = 'jira_issue'
@lcarva
lcarva / registry_usage.py
Last active January 29, 2018 18:59
Compute storage used by container images per OpenShift project
#!/bin/env python
from __future__ import print_function
from collections import Counter
import os.path
import subprocess
import json