Skip to content

Commit

Permalink
refactor: rename cli tool
Browse files Browse the repository at this point in the history
Rename tool and brew release support.

Signed-off-by: Serge Logvinov <[email protected]>
  • Loading branch information
sergelogvinov committed Feb 17, 2024
1 parent ff575d1 commit 5489208
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
go-version-file: 'go.mod'

- name: Lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: v1.55.2
args: --config=.golangci.yml
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,38 @@ jobs:
- name: Sign images
timeout-minutes: 4
run: make images-cosign

build-publish-cli:
name: "Publish cli tool"
timeout-minutes: 15
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Unshallow
run: git fetch --prune --unshallow

- name: Set up go
timeout-minutes: 5
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Generate token
uses: actions/create-github-app-token@f4c6bf6752984b3a29fcc135a5e70eb792c40c6b # v1.8.0
id: token
with:
app-id: "${{ secrets.BOT_APP_ID }}"
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
owner: "${{ github.repository_owner }}"
repositories: homebrew-pvecsictl
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_PAT: ${{ steps.token.outputs.token }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ go.work
/charts/proxmox-csi-plugin/values.*.yaml
/hack/cloud-config.yaml
/hack/kubeconfig
/hack/kubeconfig*
kubeconfig
.cache/
/log
Expand Down
80 changes: 52 additions & 28 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
project_name: pvecsi-mutate
project_name: pvecsictl

before:
hooks:
- go mod download
- make release-update

dist: bin
builds:
- dir: cmd/pvecsi-mutate
binary: pvecsi-mutate-{{ .Os }}-{{ .Arch }}
- dir: cmd/pvecsictl
binary: pvecsictl-{{ .Os }}-{{ .Arch }}
no_unique_dist_dir: true
env:
- CGO_ENABLED=0
Expand All @@ -19,33 +18,58 @@ builds:
- amd64
- arm64

archives:
- format: binary
name_template: "{{ .Binary }}"

checksum:
name_template: "checksums.txt"

snapshot:
name_template: edge

dockers:
- use: buildx
image_templates:
- ghcr.io/sergelogvinov/pvecsi-mutate:{{ .Version }}-amd64
goos: linux
goarch: amd64
build_flag_templates:
- "--label=org.opencontainers.image.version={{.Version}}"
- "--target=pvecsi-mutate-goreleaser"
- "--platform=linux/amd64"
- use: buildx
image_templates:
- ghcr.io/sergelogvinov/pvecsi-mutate:{{ .Version }}-arm64
goos: linux
goarch: arm64
build_flag_templates:
- "--label=org.opencontainers.image.version={{.Version}}"
- "--target=pvecsi-mutate-goreleaser"
- "--platform=linux/arm64"
docker_manifests:
- name_template: ghcr.io/sergelogvinov/{{ .ProjectName }}:{{ .Version }}
image_templates:
- ghcr.io/sergelogvinov/{{ .ProjectName }}:{{ .Version }}-amd64
- ghcr.io/sergelogvinov/{{ .ProjectName }}:{{ .Version }}-arm64
# dockers:
# - use: buildx
# image_templates:
# - ghcr.io/sergelogvinov/pvecsictl:{{ .Version }}-amd64
# goos: linux
# goarch: amd64
# build_flag_templates:
# - "--label=org.opencontainers.image.version={{.Version}}"
# - "--target=pvecsictl-goreleaser"
# - "--platform=linux/amd64"
# - use: buildx
# image_templates:
# - ghcr.io/sergelogvinov/pvecsictl:{{ .Version }}-arm64
# goos: linux
# goarch: arm64
# build_flag_templates:
# - "--label=org.opencontainers.image.version={{.Version}}"
# - "--target=pvecsictl-goreleaser"
# - "--platform=linux/arm64"
# docker_manifests:
# - name_template: ghcr.io/sergelogvinov/{{ .ProjectName }}:{{ .Version }}
# image_templates:
# - ghcr.io/sergelogvinov/{{ .ProjectName }}:{{ .Version }}-amd64
# - ghcr.io/sergelogvinov/{{ .ProjectName }}:{{ .Version }}-arm64

brews:
- name: pvecsictl
folder: Formula
homepage: https://github.com/sergelogvinov/proxmox-csi-plugin
description: "Proxmox VE CSI Mutate tool"
license: Apache-2.0

commit_author:
name: sergelogvinov
email: [email protected]
repository:
owner: sergelogvinov
name: homebrew-pvecsictl
branch: main
token: "{{ .Env.HOMEBREW_PAT }}"

test: |
system "#{bin}/pvecsictl -v"
install: |
bin.install "{{ .Binary }}" => "pvecsictl"
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,24 @@ ENTRYPOINT ["/bin/proxmox-csi-node"]

########################################

FROM alpine:3.18 AS pvecsi-mutate
FROM alpine:3.19 AS pvecsictl
LABEL org.opencontainers.image.source="https://github.com/sergelogvinov/proxmox-csi-plugin" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.description="Proxmox VE CSI tools"

ARG TARGETARCH
COPY --from=builder /src/bin/pvecsi-mutate-${TARGETARCH} /bin/pvecsi-mutate
COPY --from=builder /src/bin/pvecsictl-${TARGETARCH} /bin/pvecsictl

ENTRYPOINT ["/bin/pvecsi-mutate"]
ENTRYPOINT ["/bin/pvecsictl"]

########################################

FROM alpine:3.18 AS pvecsi-mutate-goreleaser
FROM alpine:3.19 AS pvecsictl-goreleaser
LABEL org.opencontainers.image.source="https://github.com/sergelogvinov/proxmox-csi-plugin" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.description="Proxmox VE CSI tools"

ARG TARGETARCH
COPY pvecsi-mutate-linux-${TARGETARCH} /bin/pvecsi-mutate
COPY pvecsictl-linux-${TARGETARCH} /bin/pvecsictl

ENTRYPOINT ["/bin/pvecsi-mutate"]
ENTRYPOINT ["/bin/pvecsictl"]
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ build-all-archs:
clean: ## Clean
rm -rf bin .cache

build-pvecsi-mutate:
build-pvecsictl:
CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build $(GO_LDFLAGS) \
-o bin/pvecsi-mutate-$(ARCH) ./cmd/pvecsi-mutate
-o bin/pvecsictl-$(ARCH) ./cmd/pvecsictl

build-%:
CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build $(GO_LDFLAGS) \
-o bin/proxmox-csi-$*-$(ARCH) ./cmd/$*

.PHONY: build
build: build-controller build-node build-pvecsi-mutate ## Build
build: build-controller build-node build-pvecsictl ## Build

.PHONY: run
run: build-controller ## Run
Expand Down Expand Up @@ -144,13 +144,13 @@ image-%:
images-checks: images image-tools-check
trivy image --exit-code 1 --ignore-unfixed --severity HIGH,CRITICAL --no-progress $(OCIREPO)/proxmox-csi-controller:$(TAG)
trivy image --exit-code 1 --ignore-unfixed --severity HIGH,CRITICAL --no-progress $(OCIREPO)/proxmox-csi-node:$(TAG)
trivy image --exit-code 1 --ignore-unfixed --severity HIGH,CRITICAL --no-progress $(OCIREPO)/pvecsi-mutate:$(TAG)
trivy image --exit-code 1 --ignore-unfixed --severity HIGH,CRITICAL --no-progress $(OCIREPO)/pvecsictl:$(TAG)

.PHONY: images-cosign
images-cosign:
@cosign sign --yes $(COSING_ARGS) --recursive $(OCIREPO)/proxmox-csi-controller:$(TAG)
@cosign sign --yes $(COSING_ARGS) --recursive $(OCIREPO)/proxmox-csi-node:$(TAG)
@cosign sign --yes $(COSING_ARGS) --recursive $(OCIREPO)/pvecsi-mutate:$(TAG)
@cosign sign --yes $(COSING_ARGS) --recursive $(OCIREPO)/pvecsictl:$(TAG)

.PHONY: images
images: image-proxmox-csi-controller image-proxmox-csi-node image-pvecsi-mutate ## Build images
images: image-proxmox-csi-controller image-proxmox-csi-node image-pvecsictl ## Build images
2 changes: 1 addition & 1 deletion cmd/pvecsi-mutate/main.go → cmd/pvecsictl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
)

var (
command = "pvecsi-mutate"
command = "pvecsictl"
version = "v0.0.0"
commit = "none"

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 5489208

Please sign in to comment.