From f4cee4072b18458a8d9cc6c30d14498d6a0c67da Mon Sep 17 00:00:00 2001 From: Marcin Maciaszczyk Date: Wed, 4 Dec 2024 17:16:56 +0100 Subject: [PATCH] remove plrlctl --- .goreleaser.yaml | 89 ---------------------------------- Makefile | 19 -------- cmd/command/plural/plural.go | 2 +- cmd/plrlctl/main.go | 87 --------------------------------- dockerfiles/plrlctl/Dockerfile | 47 ------------------ 5 files changed, 1 insertion(+), 243 deletions(-) delete mode 100644 cmd/plrlctl/main.go delete mode 100644 dockerfiles/plrlctl/Dockerfile diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 4ca582528..d610b163d 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -27,33 +27,11 @@ builds: - -X "github.com/pluralsh/plural-cli/pkg/common.Date={{.Date}}" - -X "github.com/pluralsh/plural-cli/pkg/scm.GitlabClientSecret={{.Env.GITLAB_CLIENT_SECRET}}" binary: plural - - id: plrlctl - main: ./cmd/plrlctl - targets: - - linux_amd64 - - linux_arm64 - - windows_amd64 - - windows_arm64 - - darwin_amd64 - - darwin_arm64 - env: - - CGO_ENABLED=0 - ldflags: - - -s - - -w - - -X "github.com/pluralsh/plural-cli/pkg/common.Version={{.Version}}" - - -X "github.com/pluralsh/plural-cli/pkg/common.Commit={{.Commit}}" - - -X "github.com/pluralsh/plural-cli/pkg/common.Date={{.Date}}" - - -X "github.com/pluralsh/plural-cli/pkg/scm.GitlabClientSecret={{.Env.GITLAB_CLIENT_SECRET}}" - binary: pluralctl archives: - id: plural-cli builds: [plural-cli] name_template: '{{ .ProjectName }}_{{ .Version }}_{{- title .Os -}}_{{- if eq .Arch "386" -}}i386{{- else -}}{{ .Arch }}{{- end -}}' - - id: plrlctl - builds: [plrlctl] - name_template: '{{ .Binary }}_{{ .Version }}_{{- title .Os -}}_{{- if eq .Arch "386" -}}i386{{- else -}}{{ .Arch }}{{- end -}}' checksum: name_template: 'checksums.txt' @@ -160,70 +138,3 @@ brews: test: | system "#{bin}/plural", "--help" - - - name: plrlctl - ids: [plrlctl] - repository: - owner: pluralsh - name: homebrew-plural - - # Optionally a branch can be provided. - # Defaults to the default repository branch. - branch: main - - # Optionally a token can be provided, if it differs from the token provided to GoReleaser - token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}" - - # Template for the url which is determined by the given Token (github, gitlab or gitea) - # - # Default depends on the client. - url_template: "https://github.com/pluralsh/plural-cli/releases/download/{{ .Tag }}/{{ .ArtifactName }}" - - # Allows you to set a custom download strategy. Note that you'll need - # to implement the strategy and add it to your tap repository. - # Example: https://docs.brew.sh/Formula-Cookbook#specifying-the-download-strategy-explicitly - # Default is empty. - download_strategy: CurlDownloadStrategy - - # Git author used to commit to the repository. - # Defaults are shown. - commit_author: - name: plural-bot - email: gh-bot@plural.sh - - # The project name and current git tag are used in the format string. - commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}" - - # Folder inside the repository to put the formula. - # Default is the root folder. - directory: Formula - - # Your app's homepage. - # Default is empty. - homepage: "https://docs.plural.sh" - - # Template of your app's description. - # Default is empty. - description: "CLI to manage and operate a fleet of clusters" - - # SPDX identifier of your app's license. - # Default is empty. - license: "MIT" - - # Setting this will prevent goreleaser to actually try to commit the updated - # formula - instead, the formula file will be stored on the dist folder only, - # leaving the responsibility of publishing it to the user. - # If set to auto, the release will not be uploaded to the homebrew tap - # in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1 - # Default is false. - skip_upload: "auto" - - # Custom block for brew. - # Can be used to specify alternate downloads for devel or head releases. - # Default is empty. - custom_block: | - head "https://github.com/pluralsh/plural-cli.git" - - test: | - system "#{bin}/plrlctl", "--help" - diff --git a/Makefile b/Makefile index 680418326..1060b3235 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,6 @@ include $(ROOT_DIRECTORY)/hack/include/build.mk GCP_PROJECT ?= pluralsh APP_NAME ?= plural-cli -APP_CTL_NAME ?= plrlctl APP_VSN ?= $(shell git describe --tags --always --dirty) APP_DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%S%z") BUILD ?= $(shell git rev-parse --short HEAD) @@ -27,7 +26,6 @@ WAILS_BINDINGS_TAGS ?= bindings,generate WAILS_BINDINGS_BINARY_NAME ?= wailsbindings TAGS ?= $(WAILS_TAGS) OUTFILE ?= plural.o -OUTCTLFILE ?= plrlctl.o GOBIN ?= go env GOBIN # Targets to run before other targets @@ -42,16 +40,11 @@ git-push: .PHONY: install install: go build -ldflags '$(LDFLAGS)' -o $(GOBIN)/plural ./cmd/plural - go build -ldflags '$(LDFLAGS)' -o $(GOBIN)/plrlctl ./cmd/plrlctl .PHONY: build-cli build-cli: ## Build a CLI binary for the host architecture without embedded UI go build -ldflags='$(LDFLAGS)' -o $(OUTFILE) ./cmd/plural -.PHONY: build-ctl -build-ctl: ## Build a CLI binary for the fleet management - go build -ldflags='$(LDFLAGS)' -o $(OUTCTLFILE) ./cmd/plrlctl - .PHONY: build-cli-ui build-cli-ui: $(PRE) generate-bindings ## Build a CLI binary for the host architecture with embedded UI CGO_LDFLAGS=$(CGO_LDFLAGS) go build -tags $(WAILS_TAGS) -ldflags='$(LDFLAGS)' -o $(OUTFILE) ./cmd/plural @@ -78,7 +71,6 @@ generate-bindings: build-web ## Generate backend bindings for the embedded UI .PHONY: release release: GOOS=$(GOOS) GOARCH=$(GOARCH) go build -ldflags='$(LDFLAGS)' -o $(OUTFILE) ./cmd/plural - GOOS=$(GOOS) GOARCH=$(GOARCH) go build -ldflags='$(LDFLAGS)' -o $(OUTCTLFILE) ./cmd/plrlctl .PHONY: goreleaser goreleaser: @@ -103,17 +95,6 @@ build: ## Build the Docker image -t gcr.io/$(GCP_PROJECT)/$(APP_NAME):$(APP_VSN) \ -t $(DKR_HOST)/plural/$(APP_NAME):$(APP_VSN) . -.PHONY: build-ctl -build-ctl: ## Build the plrctl Docker image - docker build --build-arg APP_NAME=$(APP_CTL_NAME) \ - --build-arg APP_VSN=$(APP_VSN) \ - --build-arg APP_DATE=$(APP_DATE) \ - --build-arg APP_COMMIT=$(BUILD) \ - -t $(APP_CTL_NAME):$(APP_VSN) \ - -t $(APP_CTL_NAME):latest \ - -t gcr.io/$(GCP_PROJECT)/$(APP_CTL_NAME):$(APP_VSN) \ - -t $(DKR_HOST)/plural/$(APP_CTL_NAME):$(APP_VSN) -f dockerfiles/plrlctl/Dockerfile . - .PHONY: build-cloud build-cloud: ## build the cloud docker image docker build --build-arg APP_NAME=$(APP_NAME) \ diff --git a/cmd/command/plural/plural.go b/cmd/command/plural/plural.go index 6a0589baa..122f1486c 100644 --- a/cmd/command/plural/plural.go +++ b/cmd/command/plural/plural.go @@ -136,7 +136,7 @@ func globalFlags() []cli.Flag { cli.BoolFlag{ Name: "bootstrap", Usage: "enable bootstrap mode", - Destination: &common.BootstrapMode, + Destination: &common.BootstrapMode, // TODO Remove Hidden: !exp.IsFeatureEnabled(exp.EXP_PLURAL_CAPI), }, } diff --git a/cmd/plrlctl/main.go b/cmd/plrlctl/main.go deleted file mode 100644 index f2ef09363..000000000 --- a/cmd/plrlctl/main.go +++ /dev/null @@ -1,87 +0,0 @@ -package main - -import ( - "log" - "os" - - "github.com/pluralsh/plural-cli/cmd/command/cd" - - "github.com/fatih/color" - "github.com/urfave/cli" - "helm.sh/helm/v3/pkg/action" - - "github.com/pluralsh/plural-cli/cmd/command/clone" - cryptocmd "github.com/pluralsh/plural-cli/cmd/command/crypto" - "github.com/pluralsh/plural-cli/cmd/command/down" - cmdinit "github.com/pluralsh/plural-cli/cmd/command/init" - "github.com/pluralsh/plural-cli/cmd/command/mgmt" - "github.com/pluralsh/plural-cli/cmd/command/pr" - "github.com/pluralsh/plural-cli/cmd/command/profile" - "github.com/pluralsh/plural-cli/cmd/command/up" - "github.com/pluralsh/plural-cli/cmd/command/version" - "github.com/pluralsh/plural-cli/pkg/client" - conf "github.com/pluralsh/plural-cli/pkg/config" - "github.com/pluralsh/plural-cli/pkg/crypto" - "github.com/pluralsh/plural-cli/pkg/utils" -) - -const ApplicationName = "plrlctl" - -type Plural struct { - client.Plural - HelmConfiguration *action.Configuration -} - -func globalFlags() []cli.Flag { - return []cli.Flag{ - cli.StringFlag{ - Name: "profile-file", - Usage: "configure your config.yml profile `FILE`", - EnvVar: "PLURAL_PROFILE_FILE", - Destination: &conf.ProfileFile, - }, - cli.StringFlag{ - Name: "encryption-key-file", - Usage: "configure your encryption key `FILE`", - EnvVar: "PLURAL_ENCRYPTION_KEY_FILE", - Destination: &crypto.EncryptionKeyFile, - }, - cli.BoolFlag{ - Name: "debug", - Usage: "enable debug mode", - EnvVar: "PLURAL_DEBUG_ENABLE", - Destination: &utils.EnableDebug, - }, - } -} - -func main() { - - plural := &Plural{} - - app := cli.NewApp() - app.Name = ApplicationName - app.Usage = "Tooling to manage and operate a fleet of clusters" - app.EnableBashCompletion = true - app.Flags = globalFlags() - commands := []cli.Command{ - cryptocmd.Command(plural.Plural), - clone.Command(), - cd.Command(plural.Plural, plural.HelmConfiguration), - up.Command(plural.Plural), - down.Command(), - pr.Command(plural.Plural), - cmdinit.Command(plural.Plural), - mgmt.Command(plural.Plural), - profile.Command(), - version.Command(), - } - app.Commands = commands - if os.Getenv("ENABLE_COLOR") != "" { - color.NoColor = false - } - err := app.Run(os.Args) - if err != nil { - log.Fatal(err) - } -} diff --git a/dockerfiles/plrlctl/Dockerfile b/dockerfiles/plrlctl/Dockerfile deleted file mode 100644 index 7fe58ad8e..000000000 --- a/dockerfiles/plrlctl/Dockerfile +++ /dev/null @@ -1,47 +0,0 @@ -FROM ubuntu:22.10 AS user - -# Create a nonroot user for final image -RUN useradd -u 10001 nonroot - -FROM golang:1.22-alpine3.19 AS builder - -WORKDIR /workspace - -# Copy the Go Modules manifests -COPY go.mod go.mod -COPY go.sum go.sum -# cache deps before building and copying source so that we don't need to re-download as much -# and so that source changes don't invalidate our downloaded layer -RUN go mod download - -# Copy the go source -COPY cmd/ cmd/ -COPY pkg/ pkg/ - -# Build -ARG APP_VSN -ARG APP_COMMIT -ARG APP_DATE -ARG TARGETARCH - -RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \ - go build -ldflags '-s -w \ - -X "github.com/pluralsh/plural-cli/pkg/common.Version=${APP_VSN}" \ - -X "github.com/pluralsh/plural-cli/pkg/common.Commit=${APP_COMMIT}" \ - -X "github.com/pluralsh/plural-cli/pkg/common.Date=${APP_DATE}"' \ - -o plrlctl ./cmd/plrlctl - -FROM golang:1.22-alpine3.19 AS final - -WORKDIR / - -RUN apk update && apk add --no-cache git build-base - -# Copy nonroot user and switch to it -COPY --from=user /etc/passwd /etc/passwd -USER nonroot - -COPY --chown=nonroot --from=builder /workspace/plrlctl /go/bin/ -RUN chmod a+x /go/bin/plrlctl - -ENTRYPOINT ["/go/bin/plrlctl"]