Skip to content

Commit aded8b1

Browse files
authored
Merge pull request #147 from luthermonson/release
Update Release Process
2 parents 83868ae + 3e6195e commit aded8b1

17 files changed

Lines changed: 155 additions & 136 deletions

File tree

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.sh text eol=lf

.github/release-drafter.yml

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

.github/workflows/ci.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Continuous Integration
2+
on:
3+
workflow_dispatch: null
4+
push:
5+
branches:
6+
- main
7+
pull_request: null
8+
9+
jobs:
10+
ci:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
go-version: [ 'stable', 'oldstable', '1.20' ]
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- uses: actions/setup-go@v4
20+
with:
21+
go-version: ${{ matrix.go-version }}
22+
- name: Vet
23+
run: make vet
24+
- name: Lint
25+
run: make lint
26+
- name: Helm Lint
27+
run: make helm-lint
28+
- name: Test
29+
run: make test
30+
- name: Build
31+
run: make build
32+
docker-build:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0
38+
- name: Docker Meta
39+
id: meta
40+
uses: docker/metadata-action@v5
41+
with:
42+
images: |
43+
linode/linode-cloud-controller-manager
44+
tags: |
45+
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
46+
type=semver,pattern={{raw}},value=${{ github.ref_name }}
47+
- name: Build Dockerfile
48+
uses: docker/build-push-action@v5
49+
with:
50+
context: .
51+
push: false
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}
54+
build-args: |
55+
REV=${{ github.ref_name }}

.github/workflows/docker-hub.yml

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

.github/workflows/label-sync.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Sync labels
22
on:
33
push:
44
branches:
5-
- master
5+
- main
66
paths:
77
- .github/labels.yml
88
jobs:

.github/workflows/release-drafter.yml

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

.github/workflows/release.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- "v*.*.*"
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
- name: Create Release Artifacts
15+
run: make release
16+
env:
17+
IMAGE_VERSION: ${{ github.ref_name }}
18+
- name: Upload Release Artifacts
19+
uses: softprops/action-gh-release@v1
20+
with:
21+
files: |
22+
./release/helm-chart-${{ github.ref_name }}.tgz
23+
- name: Docker Meta
24+
id: meta
25+
uses: docker/metadata-action@v5
26+
with:
27+
images: |
28+
linode/linode-cloud-controller-manager
29+
tags: |
30+
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
31+
type=semver,pattern={{raw}},value=${{ github.ref_name }}
32+
- name: Login to Docker Hub
33+
uses: docker/login-action@v3
34+
with:
35+
username: ${{ secrets.DOCKER_USERNAME }}
36+
password: ${{ secrets.DOCKER_PASSWORD }}
37+
- name: Build and Push to Docker Hub
38+
uses: docker/build-push-action@v5
39+
with:
40+
context: .
41+
push: true
42+
tags: ${{ steps.meta.outputs.tags }}
43+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/test.yml

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

Dockerfile

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
1-
# NB: We now cross-compile the go binary locally using the Makefile
2-
FROM alpine:latest
3-
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
4-
COPY dist/linode-cloud-controller-manager-linux-amd64 /
5-
ENTRYPOINT ["/linode-cloud-controller-manager-linux-amd64"]
1+
FROM golang:1.21-alpine as builder
2+
RUN mkdir -p /linode
3+
WORKDIR /linode
4+
5+
COPY go.mod .
6+
COPY go.sum .
7+
COPY main.go .
8+
COPY cloud ./cloud
9+
COPY sentry ./sentry
10+
11+
RUN go mod download
12+
RUN go build -a -ldflags '-extldflags "-static"' -o /bin/linode-cloud-controller-manager-linux /linode
13+
14+
FROM alpine:3.18.4
15+
RUN apk add --update --no-cache ca-certificates
16+
LABEL maintainers="Linode"
17+
LABEL description="Linode Cloud Controller Manager"
18+
COPY --from=builder /bin/linode-cloud-controller-manager-linux /linode-cloud-controller-manager-linux
19+
ENTRYPOINT ["/linode-cloud-controller-manager-linux"]

Makefile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
IMG ?= linode/linode-cloud-controller-manager:canary
2+
RELEASE_DIR ?= release
3+
GOLANGCI_LINT_IMG := golangci/golangci-lint:v1.55-alpine
24

35
export GO111MODULE=on
46

@@ -7,13 +9,19 @@ all: build
79

810
.PHONY: clean
911
clean:
10-
go clean .
11-
rm -r dist/*
12+
@go clean .
13+
@rm -rf ./.tmp
14+
@rm -rf dist/*
15+
@rm -rf $(RELEASE_DIR)
1216

1317
.PHONY: codegen
1418
codegen:
1519
go generate ./...
1620

21+
.PHONY: vet
22+
vet: fmt
23+
go vet ./...
24+
1725
.PHONY: lint
1826
lint:
1927
docker run --rm -v "$(shell pwd):/var/work:ro" -w /var/work \
@@ -43,6 +51,12 @@ build: codegen
4351
CGO_ENABLED=0 \
4452
go build -o dist/linode-cloud-controller-manager .
4553

54+
.PHONY: release
55+
release:
56+
mkdir -p $(RELEASE_DIR)
57+
sed -e 's/appVersion: "latest"/appVersion: "$(IMAGE_VERSION)"/g' ./deploy/chart/Chart.yaml
58+
tar -czvf ./$(RELEASE_DIR)/helm-chart-$(IMAGE_VERSION).tgz -C ./deploy/chart .
59+
4660
.PHONY: imgname
4761
# print the Docker image name that will be used
4862
# useful for subsequently defining it on the shell

0 commit comments

Comments
 (0)