Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Jason Hall imjasonh

🏠
Working from home
View GitHub Profile
View main.go
package main
import (
"encoding/json"
"fmt"
"log"
"os"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/name"
@imjasonh
imjasonh / test.sh
Last active Apr 16, 2021
crane append + mutate
View test.sh
docker run --rm $(
go run ./cmd/crane mutate $(
go run ./cmd/crane/ append -b busybox -f <(tar -f - -c hello.sh) -t gcr.io/kontaindotme/appended \
) --entrypoint=/hello.sh --new_ref=gcr.io/kontaindotme/mutated \
)
2021/04/16 10:44:33 No matching credentials were found for "index.docker.io/library/busybox", falling back on anonymous
2021/04/16 10:44:35 existing blob: sha256:f531cdc67389c92deac44e019e7a1b6fba90d1aaa58ae3e8192f0e0eed747152
2021/04/16 10:44:37 pushed blob: sha256:078105f9432ce9585d7f6b76a2bd0aed14b1bae9dec29ed679a6b5576cb89664
2021/04/16 10:44:37 existing blob: sha256:d6a3237b5852e9da63a291612928da68d814897550b15e9e0ca77934a8672792
2021/04/16 10:44:38 gcr.io/kontaindotme/appended: digest: sha256:a58979bf3493cbc9acea0541190c5621853bc57b4683970d847ba23ab3b660e4 size: 586
View main.go
package main
import (
"flag"
"fmt"
"log"
"strings"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/name"
View README.md

release-note aggregator

  • identifies PRs merged since the last release with kind and release notes, separates by kind, prints Markdown to stdout
  • written in Go instead of Bash
  • makes as few GitHub API requests as possible, to avoid rate limits
    • when it does hit rate limiting, it'll wait for quota and retry

Usage and example output

@imjasonh
imjasonh / .gitignore
Last active Apr 2, 2021
Demo: Shipwright using cosign to sign container images it builds
View .gitignore
secret.yaml
View gist:2a8ca3bc2f4be055af99ac9936de5346
$ cat cfg1.json cfg2.json
{
"auths": {
"registry.a": {
"auth": "base64junk-a"
},
"registry.b": {
"auth": "base64junk-b"
}
}
View crane rebase
 ~/git/go-containerregistry/ [crane-rebase] go run ./cmd/crane rebase gcr.io/kontaindotme/rebase-me
2021/03/09 12:29:04 Detected old base from "base-digest" annotation: index.docker.io/library/ubuntu@sha256:e3d7ff9efd8431d9ef39a144c45992df5502c995b9ba3c53ff70c5b52a848d9c
2021/03/09 12:29:04 Detected new base from "base-tag" annotation: ubuntu:latest
2021/03/09 12:29:04 No matching credentials were found for "index.docker.io/library/ubuntu", falling back on anonymous
2021/03/09 12:29:04 No matching credentials were found for "index.docker.io/library/ubuntu", falling back on anonymous
2021/03/09 12:29:05 Set annotation "base-digest": index.docker.io/library/ubuntu@sha256:e3d7ff9efd8431d9ef39a144c45992df5502c995b9ba3c53ff70c5b52a848d9c
2021/03/09 12:29:05 Set annotation "base-tag": ubuntu:latest
2021/03/09 12:29:05 pushing rebased image as gcr.io/kontaindotme/rebase-me
2021/03/09 12:29:06 existing blob: sha256:5d3b2c2d21bba59850dac063bcbb574fddcb6aefb444ffcc63843355d878d54f
2021/03/09 12:29:06 existing blob: sh
View main.go
package main
import (
"bytes"
"log"
"strings"
"github.com/ghodss/yaml"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/name"
View go-containerregistry
$ cat pkg/**/*.go | sort | uniq -c | sort -n | tail -n 20
195 if err != nil {
201 import (
225 )
226 // http://www.apache.org/licenses/LICENSE-2.0
226 // Licensed under the Apache License, Version 2.0 (the "License");
226 // See the License for the specific language governing permissions and
226 // Unless required by applicable law or agreed to in writing, software
226 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
226 // You may obtain a copy of the License at
View cloud-run-migration.md

GCPing is a simple single-page website where you can find out the relative latency between your browser and multiple GCP regions. GCP manages data centers around the world, but which one is closest to you, or more importantly, your customers? GCPing can answer that.

GCPing is a 20% project, and for the four years since its inception it was backed by small f1-micro GCE VMs in each region, with a public IP address, and a static HTML and JavaScript frontend served from GCS.

Over time, new regions would come online, or basic maintenance and upgrades