Skip to content
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

Update Release Process #147

Merged
merged 2 commits into from
Jan 3, 2024
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sh text eol=lf
21 changes: 0 additions & 21 deletions .github/release-drafter.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Continuous Integration
on:
workflow_dispatch: null
push:
branches:
- main
pull_request: null

jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ 'stable', 'oldstable', '1.20' ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Vet
run: make vet
- name: Lint
run: make lint
- name: Helm Lint
run: make helm-lint
- name: Test
run: make test
- name: Build
run: make build
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Docker Meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
linode/linode-cloud-controller-manager
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=semver,pattern={{raw}},value=${{ github.ref_name }}
- name: Build Dockerfile
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
REV=${{ github.ref_name }}
18 changes: 0 additions & 18 deletions .github/workflows/docker-hub.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/label-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Sync labels
on:
push:
branches:
- master
- main
paths:
- .github/labels.yml
jobs:
Expand Down
16 changes: 0 additions & 16 deletions .github/workflows/release-drafter.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release
on:
push:
tags:
- "v*.*.*"

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create Release Artifacts
run: make release
env:
IMAGE_VERSION: ${{ github.ref_name }}
- name: Upload Release Artifacts
uses: softprops/action-gh-release@v1
with:
files: |
./release/helm-chart-${{ github.ref_name }}.tgz
- name: Docker Meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
linode/linode-cloud-controller-manager
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=semver,pattern={{raw}},value=${{ github.ref_name }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push to Docker Hub
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
22 changes: 0 additions & 22 deletions .github/workflows/test.yml

This file was deleted.

24 changes: 19 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# NB: We now cross-compile the go binary locally using the Makefile
FROM alpine:latest
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
COPY dist/linode-cloud-controller-manager-linux-amd64 /
ENTRYPOINT ["/linode-cloud-controller-manager-linux-amd64"]
FROM golang:1.21-alpine as builder
RUN mkdir -p /linode
WORKDIR /linode

COPY go.mod .
COPY go.sum .
COPY main.go .
COPY cloud ./cloud
COPY sentry ./sentry

RUN go mod download
RUN go build -a -ldflags '-extldflags "-static"' -o /bin/linode-cloud-controller-manager-linux /linode

FROM alpine:3.18.4
RUN apk add --update --no-cache ca-certificates
LABEL maintainers="Linode"
LABEL description="Linode Cloud Controller Manager"
COPY --from=builder /bin/linode-cloud-controller-manager-linux /linode-cloud-controller-manager-linux
ENTRYPOINT ["/linode-cloud-controller-manager-linux"]
18 changes: 16 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
IMG ?= linode/linode-cloud-controller-manager:canary
RELEASE_DIR ?= release
GOLANGCI_LINT_IMG := golangci/golangci-lint:v1.55-alpine

export GO111MODULE=on

Expand All @@ -7,13 +9,19 @@ all: build

.PHONY: clean
clean:
go clean .
rm -r dist/*
@go clean .
@rm -rf ./.tmp
@rm -rf dist/*
@rm -rf $(RELEASE_DIR)

.PHONY: codegen
codegen:
go generate ./...

.PHONY: vet
vet: fmt
go vet ./...

.PHONY: lint
lint:
docker run --rm -v "$(shell pwd):/var/work:ro" -w /var/work \
Expand Down Expand Up @@ -43,6 +51,12 @@ build: codegen
CGO_ENABLED=0 \
go build -o dist/linode-cloud-controller-manager .

.PHONY: release
release:
mkdir -p $(RELEASE_DIR)
sed -e 's/appVersion: "latest"/appVersion: "$(IMAGE_VERSION)"/g' ./deploy/chart/Chart.yaml
tar -czvf ./$(RELEASE_DIR)/helm-chart-$(IMAGE_VERSION).tgz -C ./deploy/chart .

.PHONY: imgname
# print the Docker image name that will be used
# useful for subsequently defining it on the shell
Expand Down
Loading
Loading