Skip to content

Instantly share code, notes, and snippets.

View robandpdx's full-sized avatar
🏠
Working from home

Rob Anderson robandpdx

🏠
Working from home
  • GitHub
  • Beaverton, Oregon
View GitHub Profile
@robandpdx
robandpdx / ghec-exampes.md
Last active January 22, 2024 18:03
ghec-importer examples

ghec-importer examples

The following example will remove the teams from the migration_archive.tar.gz file.

export GHEC_IMPORTER_ADMIN_TOKEN="xxxx"
ghec-importer prepare-archive -r teams migration_archive.tar.gz

The following example will import the migration_archive.tar.gz into the robandpdx-migaration5 org and enable actions on the repo. If there is a repo name conflict, if will be resolved by adding the source org name to the repo name as a prefix.

Rewriting repository history

Sometimes history rewrites are required in order to migrate repositories into github.com. Several factors can dictate the need to rewrite history of a repository:

  • objects larger than 100Mb
  • commits larger than the 2GB push limit

Although rewriting history might not be required for your repository to migrate to github.com, you may consider rewriting history for several reasons:

  • migrate large objects to LFS
  • cleanup previous mistakes or bad practices that caused repo bloat
  • remove secrets from repo history
@robandpdx
robandpdx / kind-k8s-metrics-server.md
Last active April 4, 2023 14:53
Running metric-server on Kind Kubernetes

Running metric-server on Kind Kubernetes

Deploy latest metric-server release.

kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.5.0/components.yaml

You need to add argument --kubelet-insecure-tls to the metrics-server container.

@robandpdx
robandpdx / issue-ops-use-cases.md
Last active April 4, 2023 05:24
A list of issue ops use cases

How to get a shell on a GH runner

Getting a shell on a GH runner is pretty easy. First, create a linux VM in your favorite cloud provider. Be sure to allow inbound traffic on port 22 and 1337. SSH into that VM and execute the following command:

nc -nvlp 1337

Then run the following workflow in GH actions:

name: Reverse shell
@robandpdx
robandpdx / gist:32109989fafd4f0d1a9db11322fa1377
Created February 24, 2023 18:29 — forked from timrogers/gist:86268f626803a1dd3024459c70f2a4c9
Instructions for migrating a repo from GitHub Enterprise Server to GitHub Enterprise Cloud using `gh gei` with an unsupported blob storage provider or a supported blob storage provider using an unsupported authentication mechanism

These instructions explain how to migrate a repo from GitHub Enterprise Server to GitHub Enterprise Cloud using the gh gei CLI when either:

  • (a) you want to use an unsupported blob storage provider; or
  • (b) you want to use a supported blob storage provider with different authentication

The following instructions assume that you have curl and jq installed. There are available for Linux, macOS and Windows Subsystem for Linux (WSL).

  1. Make a note of your GitHub Enterprise Server hostname (e.g. github.acmecorp.com) and expose it as the GHES_HOST environment variable: export GHES_HOST=github.acmecorp.com.
  2. Make a note of the GitHub Enterprise Server organization that owns your origin repo, and expose it as the GHES_ORGANIZATION environment variable: export GHES_ORGANIZATION=engineering.
  3. Make a note of the name of the repo you are migrating in GitHub Enterprise Server, and expose it as the GHES_REPO environment variable: export GHES_REPO=webapp.

Migration Guide from Gerrit to GitHub

Scope of the document

This document provides the steps involved in migrating source code from Gerrit to GitHub. The CI/CD setup part is currently out of scope of this document.

Introduction

Below is a guided procedure to ensure a migration from Gerrit to GitHub.

Migration steps

The following steps act as high-level phases when implementing a migration project:

Stacked diff workflow

ghstack

ghstack
Stacked diffs and ghstack
Ghstack is a little rough around the edges. It seems to work as advertised, but some of the ways it works are a bit quirky. The following is a list of things I don't like about ghstack:

  • it creates 3 branches for each commit
  • PR are from head->base rather than from branch->master
  • you need force push access to main in order to land a PR
  • branch protection rules are useless, need to be bypassed by force pushes

PyTorch workflow testing

In order to iterate faster on workflows it is necessary to setup an environment to run the test.

  1. Launch a g5.4xlarge instance in aws with Deep Learning AMI GPU PyTorch 1.10.0 (Ubuntu 20.04) 20221003 ami-09b3fda578ad20138
  2. Generate an ssh key pair and add it to your github account.
  3. Clone pytorch/rl repo to /home/ec2-user/github/rl
  4. Use the following script to start the container and get a shell...
#!/bin/bash