Skip to content

Commit 76f0727

Browse files
jimmidysondkoshkin
andauthored
build: copy example from upstream (#2)
Co-authored-by: Dimitri Koshkin <[email protected]>
1 parent 14d52cd commit 76f0727

30 files changed

+1242
-68
lines changed

.github/workflows/goreleaser.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Copyright 2023 D2iQ, Inc. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: goreleaser
5+
6+
on:
7+
push:
8+
tags:
9+
- v*
10+
11+
permissions:
12+
contents: write
13+
packages: write
14+
issues: write
15+
16+
jobs:
17+
goreleaser:
18+
runs-on: ubuntu-22.04
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Fetch all tags
26+
run: git fetch --force --tags
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v2
30+
31+
- name: Gather tool versions
32+
uses: endorama/asdf-parse-tool-versions@v1
33+
id: versions
34+
35+
- name: Login to ghcr.io
36+
uses: docker/login-action@v2
37+
with:
38+
registry: ghcr.io
39+
username: ${{ github.actor }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
42+
- name: Install go
43+
uses: actions/setup-go@v3
44+
with:
45+
go-version: ${{ fromJson(steps.versions.outputs.tools).golang }}
46+
cache: true
47+
48+
- name: Run goreleaser
49+
uses: goreleaser/goreleaser-action@v4
50+
with:
51+
distribution: goreleaser
52+
version: ${{ fromJson(steps.versions.outputs.tools).goreleaser }}
53+
args: release --clean
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release-main.yaml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/release-please.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2023 D2iQ, Inc. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: release-please-main
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
release-please:
13+
runs-on: ubuntu-22.04
14+
steps:
15+
- uses: google-github-actions/[email protected]
16+
id: release-please
17+
with:
18+
release-type: go
19+
package-name: capi-runtime-extensions
20+
pull-request-title-pattern: "build${scope}: release${component} ${version}"
21+
changelog-notes-type: github

.gitlint

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
contrib=contrib-title-conventional-commits
99
# Do not require a body in the git commit.
1010
ignore=body-is-missing
11+
regex-style-search=True
1112

1213
[body-max-line-length]
1314
line-length=120

.go-tools

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
github.com/oligot/[email protected]
2-
gotest.tools/[email protected]
32
github.com/segmentio/[email protected]
3+
gotest.tools/[email protected]
4+
sigs.k8s.io/controller-runtime/tools/[email protected]
5+
github.com/google/go-containerregistry/cmd/[email protected]

.goreleaser.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ changelog:
2121
release:
2222
footer: |
2323
### Summary
24-
**Full Changelog**: https://github.com/d2iq-labs/capi-runtime-extensions/compare/{{ .PreviousTag }}...{{ .Tag }}
24+
**Full Changelog**: https://github.com/d2iq-labs/{{.ProjectName}}/compare/{{ .PreviousTag }}...{{ .Tag }}
2525
2626
builds:
2727
- id: capi-runtime-extensions
@@ -35,8 +35,6 @@ builds:
3535
- -w
3636
goos:
3737
- linux
38-
- windows
39-
- darwin
4038
goarch:
4139
- amd64
4240
- arm64
@@ -47,9 +45,6 @@ builds:
4745
archives:
4846
- name_template: '{{ .ProjectName }}_v{{trimprefix .Version "v"}}_{{ .Os }}_{{ .Arch }}'
4947
rlcp: true
50-
format_overrides:
51-
- goos: windows
52-
format: zip
5348
builds:
5449
- capi-runtime-extensions
5550
dockers:
@@ -61,14 +56,14 @@ dockers:
6156
#
6257
# For a release build the `-amd64` suffix will always be included and the `docker_manifests` specification below
6358
# will create the final multiplatform manifest to be pushed to the registry.
64-
- 'd2iq-labs/capi-runtime-extensions:v{{trimprefix .Version "v"}}{{ if or (not .IsSnapshot) (not (eq .Runtime.Goarch "amd64")) }}-amd64{{ end }}'
59+
- 'd2iq-labs/{{.ProjectName}}:v{{trimprefix .Version "v"}}{{ if or (not .IsSnapshot) (not (eq .Runtime.Goarch "amd64")) }}-amd64{{ end }}'
6560
use: buildx
6661
dockerfile: Dockerfile
6762
build_flag_templates:
6863
- "--platform=linux/amd64"
6964
- "--pull"
7065
- "--label=org.opencontainers.image.created={{.Date}}"
71-
- "--label=org.opencontainers.image.title=capi-runtime-extensions"
66+
- "--label=org.opencontainers.image.title={{.ProjectName}}"
7267
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
7368
- "--label=org.opencontainers.image.version={{.Version}}"
7469
- "--label=org.opencontainers.image.source={{.GitURL}}"
@@ -80,23 +75,23 @@ dockers:
8075
#
8176
# For a release build the `-amd64v8` suffix will always be included and the `docker_manifests` specification below
8277
# will create the final multiplatform manifest to be pushed to the registry.
83-
- 'd2iq-labs/capi-runtime-extensions:v{{trimprefix .Version "v"}}{{ if or (not .IsSnapshot) (not (eq .Runtime.Goarch "arm64")) }}-arm64v8{{ end }}'
78+
- 'd2iq-labs/{{.ProjectName}}:v{{trimprefix .Version "v"}}{{ if or (not .IsSnapshot) (not (eq .Runtime.Goarch "arm64")) }}-arm64v8{{ end }}'
8479
use: buildx
8580
goarch: arm64
8681
dockerfile: Dockerfile
8782
build_flag_templates:
8883
- "--platform=linux/arm64"
8984
- "--pull"
9085
- "--label=org.opencontainers.image.created={{.Date}}"
91-
- "--label=org.opencontainers.image.title=capi-runtime-extensions"
86+
- "--label=org.opencontainers.image.title={{.ProjectName}}"
9287
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
9388
- "--label=org.opencontainers.image.version={{.Version}}"
9489
- "--label=org.opencontainers.image.source={{.GitURL}}"
9590
docker_manifests:
96-
- name_template: d2iq-labs/capi-runtime-extensions:v{{trimprefix .Version "v"}}
91+
- name_template: d2iq-labs/{{.ProjectName}}:v{{trimprefix .Version "v"}}
9792
image_templates:
98-
- d2iq-labs/capi-runtime-extensions:v{{trimprefix .Version "v"}}-amd64
99-
- d2iq-labs/capi-runtime-extensions:v{{trimprefix .Version "v"}}-arm64v8
93+
- d2iq-labs/{{.ProjectName}}:v{{trimprefix .Version "v"}}-amd64
94+
- d2iq-labs/{{.ProjectName}}:v{{trimprefix .Version "v"}}-arm64v8
10095
checksum:
10196
name_template: 'checksums.txt'
10297
snapshot:

.tool-versions

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ golang 1.19.5
44
golangci-lint 1.50.1
55
goreleaser 1.15.0
66
helm 3.11.0
7+
kube-controller-tools 0.11.2
8+
kustomize 4.5.7
79
pre-commit 3.0.2
810
shfmt 3.6.0
911
upx 4.0.2
12+
gcloud 416.0.0

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# syntax=docker/dockerfile:1.4
2+
3+
# Copyright 2023 D2iQ, Inc. All rights reserved.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
FROM --platform=linux/amd64 gcr.io/distroless/static@sha256:93bb1b564033909a660111671303f9683e13f0567de95e4b6fde3226e532955e as linux-amd64
7+
FROM --platform=linux/arm64 gcr.io/distroless/static@sha256:72fec9960c247e7e68ed1db4b5b561f6b6da437215fb41d5fd7df790ec6df1a7 as linux-arm64
8+
9+
FROM --platform=linux/${TARGETARCH} linux-${TARGETARCH}
10+
11+
COPY capi-runtime-extensions /usr/local/bin/capi-runtime-extensions
12+
13+
# Use uid of nonroot user (65532) because kubernetes expects numeric user when applying pod security policies
14+
USER 65532
15+
ENTRYPOINT ["/usr/local/bin/capi-runtime-extensions"]

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@
33

44
REPO_ROOT := $(CURDIR)
55

6+
# Versions for tools that are not managed by asdf.
7+
ENVTEST_VERSION=1.25.x
8+
69
include make/all.mk

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!--
2+
Copyright 2023 D2iQ, Inc. All rights reserved.
3+
SPDX-License-Identifier: Apache-2.0
4+
-->
5+
6+
# CAPI Runtime Extensions Server
7+
8+
See [upstream documentation](https://cluster-api.sigs.k8s.io/tasks/experimental-features/runtime-sdk/index.html).

0 commit comments

Comments
 (0)