Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into sebastian/prod-2721-t…
Browse files Browse the repository at this point in the history
…hink-up-a-test-strategy-for-plural-up
  • Loading branch information
maciaszczykm committed Dec 19, 2024
2 parents 80bc7f4 + 5883324 commit 41cf975
Show file tree
Hide file tree
Showing 308 changed files with 308 additions and 48,845 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
actions: read
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
Expand Down Expand Up @@ -164,7 +164,7 @@ jobs:
actions: read
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
Expand Down Expand Up @@ -229,7 +229,7 @@ jobs:
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Run Trivy vulnerability scanner in fs mode
uses: aquasecurity/trivy-action@master
with:
Expand All @@ -248,7 +248,7 @@ jobs:
name: Unit test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
Expand All @@ -264,17 +264,18 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.59.1
version: v1.62.2
skip-cache: true
build:
name: GoReleaser build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4.1.0
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: GoReleaser (Build)
Expand Down
89 changes: 0 additions & 89 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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: [email protected]

# 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"
53 changes: 2 additions & 51 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -23,12 +22,7 @@ LDFLAGS ?= $(BASE_LDFLAGS) $\
-X "$(PACKAGE)/pkg/common.Date=$(APP_DATE)" $\
-X "$(PACKAGE)/pkg/scm.GitlabClientSecret=${GITLAB_CLIENT_SECRET}" $\
-X "$(PACKAGE)/pkg/scm.BitbucketClientSecret=${BITBUCKET_CLIENT_SECRET}"
WAILS_TAGS ?= desktop,production,ui,debug
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
Expand All @@ -47,45 +41,13 @@ install: install-cli install-ctl
install-cli:
go build -ldflags '$(LDFLAGS)' -o $(GOBIN)/plural ./cmd/plural

.PHONY: install-ctl
install-ctl:
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

.PHONY: build-web
build-web: ## Build just the embedded UI
cd pkg/ui/web && yarn --immutable && yarn build

.PHONY: run-web
run-web: $(PRE) ## Run the UI for development
@CGO_LDFLAGS=$(CGO_LDFLAGS) wails dev -tags ui -browser -skipbindings

# This is somewhat an equivalent of wails `GenerateBindings` method.
# Ref: https://github.com/wailsapp/wails/blob/master/v2/pkg/commands/bindings/bindings.go#L28
.PHONY: generate-bindings
generate-bindings: build-web ## Generate backend bindings for the embedded UI
@echo Building bindings binary
@CGO_LDFLAGS=$(CGO_LDFLAGS) go build -tags $(WAILS_BINDINGS_TAGS) -ldflags='$(LDFLAGS)' -o $(WAILS_BINDINGS_BINARY_NAME) .
@echo Generating bindings
@./$(WAILS_BINDINGS_BINARY_NAME) > /dev/null 2>&1
@echo Cleaning up
@rm $(WAILS_BINDINGS_BINARY_NAME)

.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:
Expand All @@ -110,17 +72,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-image
build-ctl-image: ## 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-image
build-cloud-image: ## build the cloud docker image
docker build --build-arg APP_NAME=$(APP_NAME) \
Expand Down Expand Up @@ -227,15 +178,15 @@ e2e: --ensure-venom

.PHONY: format
format: ## formats all go code to prep for linting
docker run --rm -v $(PWD):/app -w /app golangci/golangci-lint:v1.59.1 golangci-lint run --fix
docker run --rm -v $(PWD):/app -w /app golangci/golangci-lint:v1.62.2 golangci-lint run --fix

.PHONY: genmock
genmock: ## generates mocks before running tests
hack/gen-client-mocks.sh

.PHONY: lint
lint:
docker run --rm -v $(PWD):/app -w /app golangci/golangci-lint:v1.59.1 golangci-lint run
docker run --rm -v $(PWD):/app -w /app golangci/golangci-lint:v1.62.2 golangci-lint run

.PHONY: delete-tag
delete-tag:
Expand Down
77 changes: 12 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,82 +1,29 @@
# Plural CLI

The plural cli automates all gitops operations for your deployments of plural applications. The core workflow should mostly be as simple as:

```bash
plural build
plural deploy
```

And if you want to teardown your infrastructure, you can simply run:

```bash
plural destroy
```

To add, update or reconfigure any applications deployed by plural. But it goes even deeper and solves things like:

* Secret management (via a similar mechanism as git-crypt)
* Application Health checking - `plural watch APP`
* Log tailing - `plural logs list APP` and `plural logs tail APP LOGSTREAM`
* Setting up secure proxies into databases, private web UIs - `plural proxy list APP` and `plural proxy connect APP NAME`
Deploying your services using the Plural CLI.

## Installation

There are a number of means to install plural, the simplest is to use our homebrew tap if you're using mac:
The Plural CLI is available on homebrew, a single line install can be done with:

```bash
brew install pluralsh/plural/plural
```

More detailed instructions for other platforms can be found at https://docs.plural.sh/getting-started#1.-install-plural-cli-and-dependencies

Plural does require a few other cli's to be installed, namely:
* helm
* terraform
* kubectl
* cloud provider cli for the infrastructure you're deploying to, like `awscli`, `gcloud`, etc
* [kind](https://kind.sigs.k8s.io/) if using kind to deploy a local cluster for testing

## Setup

The core workflow is all git based, so you should create a git repository on github or wherever you're using SCM, clone it locally, then run:
If you are using a machine that is not compatible with homebrew,
we recommend simply downloading a pre-built release on github and installing it onto your machines path. The releases can be found here: https://github.com/pluralsh/plural-cli/releases.

```bash
plural init
```
## Requirements

You'll want to then install a bundle for whatever application you'd like, we'll use https://github.com/airbytehq/airbyte as an example. You can search for the bundles using:
Plural does require a few other CLI's to be installed, namely:
* `helm`
* `terraform`
* `kubectl`
* cloud provider CLI for the infrastructure you're deploying to, like `aws`, `az`, `gcloud` etc.

## Quickstart

```bash
plural bundle list airbyte
```

And chose one (using aws as an example cloud provider target) like:

```bash
plural bundle install airbyte airbyte-aws
```

This will set the basic configuration parameters for all the infrastructure needed to install airbyte. Then just run:

```bash
plural build
plural deploy --commit "deploying my first plural app!"
```

To install it.


## Installing the Plural Console

We highly recommend installing the [plural console](https://github.com/pluralsh/console) alongside your plural applications. That can be done easily with:

```bash
plural bundle install console console-aws
plural build
plural deploy --commit "deploying the plural console"
```
Detailed instructions can be found at https://docs.plural.sh/deployments/cli-quickstart.

## Reaching Out

Expand Down
File renamed without changes.
Loading

0 comments on commit 41cf975

Please sign in to comment.