toghsh translates github actions workflows to shell scripts

togsh - extracts shell commands from github actions workflows

toghsh is a helper tool to translate github action workflows into equivalent shell scripts. toghsh cannot, and will not translate github actions into shell-script equivalent.

When I should use toghsh

In the narrow but relevant use case on which you run end-to-end (e2e) tests as github workflows, relying on shell commands to setup and run the suite, then toghsh can help you.

You can keep the master source of the e2e tests as github workflows, and use toghsh to generate a runnable shell script for your local/custom worker.

You are advised and strongly encouraged to look at act for a more comprehensive solution.

Usage

  1. fetch the toghsh source tree
  2. run make
  3. copy the binary (_out/toghsh by default) in your $PATH

Example

$ ./_out/toghsh --help
Usage of ./_out/toghsh:
  -J, --job-id string   process job
  -L, --list            list available jobs and exit
pflag: help requested

$ curl -L https://raw.githubusercontent.com/k8stopologyawareschedwg/resource-topology-exporter/master/.github/workflows/e2e.yml -o example.yaml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3518  100  3518    0     0  14242      0 --:--:-- --:--:-- --:--:-- 14242

$ ./_out/toghsh --list example.yaml 
job: "e2e-ic"
job: "e2e-ip"

$ ./_out/toghsh --job-id e2e-ic example.yaml 
### setup environment as per job "e2e-ic"
export RTE_CONTAINER_IMAGE=quay.io/k8stopologyawarewg/resource-topology-exporter:ci

### order=0 - ID="" - name="checkout sources"
### nothing to run

### order=1 - ID="go" - name="setup golang"
### nothing to run

### order=2 - ID="" - name="build test binary"
make build-e2e

### order=3 - ID="" - name="build image"
RTE_CONTAINER_IMAGE=${RTE_CONTAINER_IMAGE} RUNTIME=docker make image

### order=4 - ID="" - name="generate manifests"
RTE_CONTAINER_IMAGE=${RTE_CONTAINER_IMAGE} RTE_POLL_INTERVAL=10s make gen-manifests | tee rte-e2e.yaml

### order=5 - ID="" - name="create K8S kind cluster"
# kind is part of 20.04 image, see: https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md
kind create cluster --config=hack/kind-config-e2e.yaml --image kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6
kind load docker-image ${RTE_CONTAINER_IMAGE}

### order=6 - ID="" - name="deploy RTE"
# TODO: what about the other workers (if any)?
kubectl label node kind-worker node-role.kubernetes.io/worker=''
kubectl create -f rte-e2e.yaml

### order=7 - ID="" - name="cluster info"
kubectl get nodes
kubectl get pods -A
kubectl describe pod -l name=resource-topology || :
kubectl logs -l name=resource-topology -c resource-topology-exporter-container || :

### order=8 - ID="" - name="cluster ready"
hack/check-ds.sh
kubectl logs -l name=resource-topology -c resource-topology-exporter-container || :
kubectl get noderesourcetopologies.topology.node.k8s.io -A -o yaml

### order=9 - ID="" - name="run E2E tests"
export KUBECONFIG=${HOME}/.kube/config 
_out/rte-e2e.test -ginkgo.focus='\[(RTE|TopologyUpdater)\].*\[(Local|InfraConsuming)\]'
Owner
Francesco Romani
Geek from the previous millennium. Flips bits from 0 to 1 and back. Linux user. Wearing a red hat. Personal account: gitlab.com/mojaves
Francesco Romani
Similar Resources

Automatic sync from IMDb to Trakt (watchlist, lists, ratings and history) using GitHub actions

imdb-trakt-sync GoLang app that can sync IMDb and Trakt user data - watchlist, ratings and lists. For its data needs, the app is communicating with th

Jan 2, 2023

Github Cloud Shell

Github Cloud Shell

GitHub Shell ghsh (or Github shell) is a command line tool available for windows, linux and macos that lets you use github as a shell. It is not anoth

May 11, 2022

An operator to support Haschicorp Vault configuration workflows from within Kubernetes

Vault Config Operator This operator helps set up Vault Configurations. The main intent is to do so such that subsequently pods can consume the secrets

Sep 30, 2022

An operator to support Haschicorp Vault configuration workflows from within Kubernetes

An operator to support Haschicorp Vault configuration workflows from within Kubernetes

Vault Config Operator This operator helps set up Vault Configurations. The main intent is to do so such that subsequently pods can consume the secrets

Dec 19, 2022

AwGo — A Go library for Alfred workflows

 AwGo — A Go library for Alfred workflows

AwGo — A Go library for Alfred workflows Full-featured library to build lightning-fast workflows in a jiffy. Features Installation & usage Documentati

Dec 30, 2022

Terraform utility provider for constructing bash scripts that use data from a Terraform module

Terraform Bash Provider This is a Terraform utility provider which aims to robustly generate Bash scripts which refer to data that originated in Terra

Sep 6, 2022

preflight helps you verify scripts and executables to mitigate chain of supply attacks such as the recent Codecov hack.

preflight helps you verify scripts and executables to mitigate chain of supply attacks such as the recent Codecov hack.

💣 Mitigate chain of supply attacks 👌 Verify your curl scripts and executables 🤔 What is it? preflight helps you verify scripts and executables to m

Nov 18, 2022

crud is a cobra based CLI utility which helps in scaffolding a simple go based micro-service along with build scripts, api documentation, micro-service documentation and k8s deployment manifests

crud crud is a CLI utility which helps in scaffolding a simple go based micro-service along with build scripts, api documentation, micro-service docum

Nov 29, 2021

Use this program to embed sh scripts in binaries

sh2bin Use this program to embed sh scripts in binaries. Feel free to fork this

Jan 4, 2023
Related tags
Provider-generic-workflows - A generic provider which uses argo workflows to define the backend actions.

provider-generic-workflows provider-generic-workflows is a generic provider which uses argo workflows for managing the external resource. This will re

Jan 1, 2022
github-actions-merger is github actions that merges pull request with commit message including pull request labels.

github-actions-merger github-actions-merger is github actions that merges pull request with commit message including pull request labels. Usage Write

Dec 7, 2022
A simple Go app and GitHub workflow that shows how to use GitHub Actions to test, build and deploy a Go app to Docker Hub

go-pipeline-demo A repository containing a simple Go app and GitHub workflow that shows how to use GitHub Actions to test, build and deploy a Go app t

Nov 17, 2021
Making it easy to write shell-like scripts in Go
Making it easy to write shell-like scripts in Go

import github.com/bitfield/script What is script? script is a Go library for doing the kind of tasks that shell scripts are good at: reading files, ex

Jan 9, 2023
CI/CD with Jenkins, GitHub Actions, Travis CI etc

CI/CD with Jenkins, GitHub Actions, Travis CI etc This is a simple repository built using Golang with the main purpose to try out different CI/CD tool

Nov 11, 2021
A reverse engineered github actions compatible self-hosted runner using nektos/act to execute your workflow steps

github-act-runner A reverse engineered github actions compatible self-hosted runner using nektos/act to execute your workflow steps. Unlike the offici

Dec 24, 2022
Gophercon lab "Get Go-ing with GitHub Actions"

GitHub Action Using Go This is a starting point for a GitHub Action based in Go. This repo provides all the structure needed to build a robust GitHub

Dec 8, 2021
Example goreleaser + github actions config with keyless signing and SBOM generation

supply-chain-example GoReleaser + Go Mod proxying + Cosign keyless signing + Syft SBOM generation example. How it works GoReleaser manages the entire

Nov 15, 2022
Jan 4, 2022
Generic inquiry tool to OPA server for CI process, such as GitHub Actions

opaq opaq is a generic inquiry tool to OPA server. A major purpose of this tool is for inquiry in GitHub Actions. Features Data formatting: OPA server

Jan 20, 2022