Skip to content

build: copy example from upstream #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright 2023 D2iQ, Inc. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

name: goreleaser

on:
push:
tags:
- v*

permissions:
contents: write
packages: write
issues: write

jobs:
goreleaser:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Fetch all tags
run: git fetch --force --tags

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Gather tool versions
uses: endorama/asdf-parse-tool-versions@v1
id: versions

- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Install go
uses: actions/setup-go@v3
with:
go-version: ${{ fromJson(steps.versions.outputs.tools).golang }}
cache: true

- name: Run goreleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: ${{ fromJson(steps.versions.outputs.tools).goreleaser }}
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45 changes: 0 additions & 45 deletions .github/workflows/release-main.yaml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2023 D2iQ, Inc. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

name: release-please-main

on:
push:
branches:
- main

jobs:
release-please:
runs-on: ubuntu-22.04
steps:
- uses: google-github-actions/[email protected]
id: release-please
with:
release-type: go
package-name: capi-runtime-extensions
pull-request-title-pattern: "build${scope}: release${component} ${version}"
changelog-notes-type: github
1 change: 1 addition & 0 deletions .gitlint
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
contrib=contrib-title-conventional-commits
# Do not require a body in the git commit.
ignore=body-is-missing
regex-style-search=True

[body-max-line-length]
line-length=120
Expand Down
4 changes: 3 additions & 1 deletion .go-tools
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
github.com/oligot/[email protected]
gotest.tools/[email protected]
github.com/segmentio/[email protected]
gotest.tools/[email protected]
sigs.k8s.io/controller-runtime/tools/[email protected]
github.com/google/go-containerregistry/cmd/[email protected]
21 changes: 8 additions & 13 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ changelog:
release:
footer: |
### Summary
**Full Changelog**: https://github.com/d2iq-labs/capi-runtime-extensions/compare/{{ .PreviousTag }}...{{ .Tag }}
**Full Changelog**: https://github.com/d2iq-labs/{{.ProjectName}}/compare/{{ .PreviousTag }}...{{ .Tag }}

builds:
- id: capi-runtime-extensions
Expand All @@ -35,8 +35,6 @@ builds:
- -w
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
Expand All @@ -47,9 +45,6 @@ builds:
archives:
- name_template: '{{ .ProjectName }}_v{{trimprefix .Version "v"}}_{{ .Os }}_{{ .Arch }}'
rlcp: true
format_overrides:
- goos: windows
format: zip
builds:
- capi-runtime-extensions
dockers:
Expand All @@ -61,14 +56,14 @@ dockers:
#
# For a release build the `-amd64` suffix will always be included and the `docker_manifests` specification below
# will create the final multiplatform manifest to be pushed to the registry.
- 'd2iq-labs/capi-runtime-extensions:v{{trimprefix .Version "v"}}{{ if or (not .IsSnapshot) (not (eq .Runtime.Goarch "amd64")) }}-amd64{{ end }}'
- 'd2iq-labs/{{.ProjectName}}:v{{trimprefix .Version "v"}}{{ if or (not .IsSnapshot) (not (eq .Runtime.Goarch "amd64")) }}-amd64{{ end }}'
use: buildx
dockerfile: Dockerfile
build_flag_templates:
- "--platform=linux/amd64"
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title=capi-runtime-extensions"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
Expand All @@ -80,23 +75,23 @@ dockers:
#
# For a release build the `-amd64v8` suffix will always be included and the `docker_manifests` specification below
# will create the final multiplatform manifest to be pushed to the registry.
- 'd2iq-labs/capi-runtime-extensions:v{{trimprefix .Version "v"}}{{ if or (not .IsSnapshot) (not (eq .Runtime.Goarch "arm64")) }}-arm64v8{{ end }}'
- 'd2iq-labs/{{.ProjectName}}:v{{trimprefix .Version "v"}}{{ if or (not .IsSnapshot) (not (eq .Runtime.Goarch "arm64")) }}-arm64v8{{ end }}'
use: buildx
goarch: arm64
dockerfile: Dockerfile
build_flag_templates:
- "--platform=linux/arm64"
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title=capi-runtime-extensions"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
docker_manifests:
- name_template: d2iq-labs/capi-runtime-extensions:v{{trimprefix .Version "v"}}
- name_template: d2iq-labs/{{.ProjectName}}:v{{trimprefix .Version "v"}}
image_templates:
- d2iq-labs/capi-runtime-extensions:v{{trimprefix .Version "v"}}-amd64
- d2iq-labs/capi-runtime-extensions:v{{trimprefix .Version "v"}}-arm64v8
- d2iq-labs/{{.ProjectName}}:v{{trimprefix .Version "v"}}-amd64
- d2iq-labs/{{.ProjectName}}:v{{trimprefix .Version "v"}}-arm64v8
checksum:
name_template: 'checksums.txt'
snapshot:
Expand Down
3 changes: 3 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ golang 1.19.5
golangci-lint 1.50.1
goreleaser 1.15.0
helm 3.11.0
kube-controller-tools 0.11.2
kustomize 4.5.7
pre-commit 3.0.2
shfmt 3.6.0
upx 4.0.2
gcloud 416.0.0
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# syntax=docker/dockerfile:1.4

# Copyright 2023 D2iQ, Inc. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

FROM --platform=linux/amd64 gcr.io/distroless/static@sha256:93bb1b564033909a660111671303f9683e13f0567de95e4b6fde3226e532955e as linux-amd64
FROM --platform=linux/arm64 gcr.io/distroless/static@sha256:72fec9960c247e7e68ed1db4b5b561f6b6da437215fb41d5fd7df790ec6df1a7 as linux-arm64

FROM --platform=linux/${TARGETARCH} linux-${TARGETARCH}

COPY capi-runtime-extensions /usr/local/bin/capi-runtime-extensions

# Use uid of nonroot user (65532) because kubernetes expects numeric user when applying pod security policies
USER 65532
ENTRYPOINT ["/usr/local/bin/capi-runtime-extensions"]
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@

REPO_ROOT := $(CURDIR)

# Versions for tools that are not managed by asdf.
ENVTEST_VERSION=1.25.x

include make/all.mk
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!--
Copyright 2023 D2iQ, Inc. All rights reserved.
SPDX-License-Identifier: Apache-2.0
-->

# CAPI Runtime Extensions Server

See [upstream documentation](https://cluster-api.sigs.k8s.io/tasks/experimental-features/runtime-sdk/index.html).
Loading