Skip to content

Commit

Permalink
Release containership v2 (#8)
Browse files Browse the repository at this point in the history
* Create CODE_OF_CONDUCT.md

* Setup new CMOs

* Reintroduce some v1 logic

* Functional testing updates

* Linting

* Testing setup

* Typo

* Remove kind. Using testenv

* Remove destinations and just use RegistriesConfig

* Linting

* List tags and copy images between registries (#5)

* Rough implementation of listing tags - untested

* Use go-containerregistry package

* implement testing

* Testing documentation

* Linting

* Pull and push images

* Switch to crane for registry requests

* Linting

* Remove unused code

* Delete image tags (#6)

* Rough implementation of listing tags - untested

* Use go-containerregistry package

* implement testing

* Testing documentation

* Linting

* Pull and push images

* Switch to crane for registry requests

* Linting

* Remove unused code

* Delete image tags

* Improve documentation

* Try reducing complexity of Run

* CMO setup docs

* Cherry pick the doc changes out for a new pr

* docs: how to deploy and use containership (#7)

* Update releaser github action

* Test again

* Update changelog

* Generate yaml file on release

* Use makefile to generate yaml

* Fix version bug

* Typos

* Improve documentation

* Added deployment instructions

* Update README.md

* Force lint to run again

* Bump again. Grrr github actions
  • Loading branch information
Chris Lenard authored Jun 2, 2021
1 parent fe46f6b commit 8fde7ba
Show file tree
Hide file tree
Showing 105 changed files with 2,724 additions and 2,580 deletions.
36 changes: 36 additions & 0 deletions .chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{{ if .Versions -}}

[Unreleased]
{{ if .Unreleased.CommitGroups -}} {{ range .Unreleased.CommitGroups -}}

{{ .Title }}
{{ range .Commits -}}

{{ if .Scope }}{{ .Scope }}: {{ end }}{{ .Subject }} - [{{ .Hash.Short }}]({{ $.Info.RepositoryURL }}/commit/{{ .Hash.Short }}) {{ end }} {{ end -}} {{ end -}} {{ end -}}
{{ range .Versions }}

{{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ range .CommitGroups -}}

{{ .Title }}
{{ range .Commits -}}

{{ if .Scope }}{{ .Scope }}: {{ end }}{{ .Subject }} - [{{ .Hash.Short }}]({{ $.Info.RepositoryURL }}/commit/{{ .Hash.Short }}) {{ end }} {{ end -}}
{{- if .RevertCommits -}}

Reverts
{{ range .RevertCommits -}}

{{ .Revert.Header }} {{ end }} {{ end -}}
{{- if .MergeCommits -}}

Pull Requests
{{ range .MergeCommits -}}

{{ .Header }} {{ end }} {{ end -}}
{{- if .NoteGroups -}} {{ range .NoteGroups -}}

{{ .Title }}
{{ range .Notes }} {{ .Body }} {{ end }} {{ end -}} {{ end -}} {{ end -}}

{{- if .Versions }} [Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD {{ range .Versions -}} {{ if .Tag.Previous -}} [{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }} {{ end -}} {{ end -}} {{ end -}}
39 changes: 39 additions & 0 deletions .chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/relativityone/helm-charts
options:
commit_groups:
title_maps:
build: Build 🏭
chore: Maintenance 🔧
ci: Continuous Integration 💜
docs: Documentation 📘
feat: Features 🌈
fix: Bug Fixes 🐞
perf: Performance Improvements 🚀
refactor: Code Refactoring 💎
revert: Revert Change ◀️
style: Code Style 🎶
test: Testing 💚
sec: Security 🛡️
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
issues:
prefix:
- DEVOPS-
refs:
actions:
- Closes
merges:
pattern: "^Merge pull request '(\\w+)'$"
pattern_maps:
- Subject
notes:
keywords:
- BREAKING CHANGE
33 changes: 11 additions & 22 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.177.0/containers/go/.devcontainer/base.Dockerfile

# [Choice] Go version: 1, 1.16, 1.15
ARG VARIANT="1.16"
ARG VARIANT="1.15"
FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT}

# [Option] Install Node.js
Expand All @@ -14,7 +14,7 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
#
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
&& apt-get -y install git iproute2 procps lsb-release \
&& apt-get -y install git iproute2 procps lsb-release vim \
#
# Docker install
&& apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common \
Expand All @@ -28,24 +28,8 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

# Install gocode-gomod
RUN go get -x -d github.com/stamblerre/gocode 2>&1 \
&& go build -o gocode-gomod github.com/stamblerre/gocode \
&& mv gocode-gomod $GOPATH/bin/ \
#
# Install Go tools
&& GOPATH=/tmp/gotools GO111MODULE=on go get -u -v \
github.com/uudashr/gopkgs/v2/cmd/gopkgs@latest \
github.com/ramya-rao-a/go-outline@latest \
github.com/cweill/gotests/...@latest \
github.com/fatih/gomodifytags@latest \
github.com/josharian/impl@latest \
github.com/mbenkmann/goformat/goformat@latest \
github.com/haya14busa/goplay/cmd/goplay@latest \
github.com/go-delve/delve/cmd/dlv@latest \
golang.org/x/tools/gopls@latest 2>&1 \
# Install golangci-lint
&& curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.39.0
# Install golangci-lint
RUN github.com/stamblerre/gocodecurl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.39.0

# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
Expand All @@ -59,7 +43,12 @@ RUN curl -LO https://github.com/operator-framework/operator-sdk/releases/downloa
&& rm operator-sdk_linux_amd64

# Install kubectl
ENV KUBECTL_VERSION=1.18.6
ENV KUBECTL_VERSION=1.19.11
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl \
&& chmod +x ./kubectl \
&& sudo mv ./kubectl /usr/local/bin/kubectl
&& sudo mv ./kubectl /usr/local/bin/kubectl

# Install Kind
RUN curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.0/kind-linux-amd64 \
&& chmod +x ./kind \
&& mv ./kind /usr/local/bin/kind
17 changes: 13 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,29 @@
"NODE_VERSION": "lts/*"
}
},
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
"runArgs": [ "--init", "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
"mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],

// Set *default* container specific settings.json values on container create.
"settings": {
"editor.tabSize": 2,
"terminal.integrated.shell.linux": "/bin/bash",
"go.toolsManagement.checkForUpdates": "local",
"go.useLanguageServer": true,
"go.gopath": "/go",
"go.goroot": "/usr/local/go"
"go.goroot": "/usr/local/go",
"[go]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
},
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"golang.Go"
"golang.Go",
"adamhartford.vscode-base64"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
Expand All @@ -35,5 +44,5 @@
// "postCreateCommand": "go version",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
// "remoteUser": "vscode"
}
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Ignore all files which are not go type
!**/*.go
!**/*.mod
!**/*.sum
25 changes: 25 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!-- Thank you for helping Containership with a pull request!
Use conventional commit messages, such as
feat: Updated something in the r1-istio helm chart
or
fix: repair hole in wumpus
Common commit types:
build: Build
chore: Maintenance
ci: Continuous Integration
docs: Documentation
feat: Features
fix: Bug Fixes
perf: Performance Improvements
refactor: Code Refactoring
revert: Revert Change
style: Code Style
test: Testing
sec: Security
-->

**Change Explanation**:
<!-- What does this PR improve or fix in Kubernetes Shared Compute? -->

**Notes**:
13 changes: 13 additions & 0 deletions .github/badge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
types:
build: Build
chore: Maintenance
ci: Continuous Integration
docs: Documentation
feat: Features
fix: Bug Fixes
perf: Performance Improvements
refactor: Code Refactoring
revert: Revert Change
style: Code Style
test: Testing
sec: Security
29 changes: 0 additions & 29 deletions .github/workflows/go-release.yml

This file was deleted.

4 changes: 1 addition & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ on:
push:
tags:
- v*
branches:
- main
pull_request:

jobs:
golangci:
name: lint
Expand Down
84 changes: 84 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Release

on:
push:
tags:
- "*"
# TODO: only main branch

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Generate Release Notes
id: changelog
uses: ./.github/changelog

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14

- name: Run GoReleaser
uses: goreleaser/[email protected]
with:
version: latest
args: release --rm-dist --release-notes=${{ steps.changelog.outputs.filepath }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}

- name: Release Deployment YAML file
run: make release
env:
VERSION: ${{ steps.get_version.outputs.VERSION }}

# Get release information to determine id of the current release
- name: Get Release
id: get-release-info
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Upload deployment YAML file to GitHub release
- name: Upload Deployment YAML file
id: upload-deployment-yaml
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: https://uploads.github.com/repos/relativitydev/containership/releases/${{ steps.get-release-info.outputs.id }}/assets?name=containership-${{ steps.get_version.outputs.VERSION }}.yaml
asset_path: containership-${{ steps.get_version.outputs.VERSION }}.yaml
asset_name: containership-${{ steps.get_version.outputs.VERSION }}.yaml
asset_content_type: application/x-yaml

push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"

- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
push: true
tags: relativitydev/containership:latest,relativitydev/containership:${{ steps.previoustag.outputs.tag }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
/bin
cover.out
.env
/testbin
Loading

0 comments on commit 8fde7ba

Please sign in to comment.