Weave GitOps
Weave GitOps enables an effective GitOps workflow for continuous delivery of applications into Kubernetes clusters. It is based on CNCF Flux, a leading GitOps engine.
Mac / Linux
curl --silent --location "https://github.com/weaveworks/weave-gitops/releases/download/v0.6.2/gitops-$(uname)-$(uname -m).tar.gz" | tar xz -C /tmp
sudo mv /tmp/gitops /usr/local/bin
gitops version
Alternatively, users can use Homebrew:
brew tap weaveworks/tap
brew install weaveworks/tap/gitops
Please see the getting started guide.
Weave GitOps
Command line utility for managing Kubernetes applications via GitOps.
Usage:
gitops [command]
Available Commands:
app Add or status application
flux Use flux commands
help Help about any command
install Install or upgrade Weave GitOps
ui Manages Weave GitOps UI
uninstall Uninstall Weave GitOps
version Display Weave GitOps version
Flags:
-h, --help Help for gitops
--namespace string The namespace scope for this operation (default "wego-system").
-v, --verbose Enable verbose output
Use "gitops [command] --help" for more information about a command.
For more information please see the docs
To set up a development environment for the CLI
- Install go v1.17
- Install buf
- Run
make all
to install dependencies and build binaries and assets - Start a
kind
cluster like so:KIND_CLUSTER_NAME=<some name> ./tools/kind-with-registry.sh
- Run
./bin/gitops install --config-repo=<repo url>
- Start the in-cluster API replacement job (powered by http://tilt.dev) with
make cluster-dev
- make or make unit-tests to ensure everything built correctly.
- You may need to turn off your
kustomize-controller
to prevent it from reconciling your "GitOps RunTime" and over-writing thewego-app
deployment. - Setting the system kustomization to
suspend: true
in the config repo will also keepkustomize-controller
from fighting withtilt
. You may need to kill a failing pod after suspending the kustomization.
We are using Ginko for our unit tests. To execute the all the unit tests, run make unit-tests
.
To run a single test, you will need to set the KUBEBUILDER_ASSESTS environment variable to point to the directory containing our mock K8s objects.
export KUBEBUILDER_ASSETS=$(git rev-parse --show-toplevel)/tools/bin/envtest
go test github.com/weaveworks/weave-gitops/pkg/kube
or
export KUBEBUILDER_ASSETS=$(git rev-parse --show-toplevel)/tools/bin/envtest
cd pkg/kube
go test
Ginkgo allows you to run a subset of Describe/Context/It specs. See Focused Specs for more information
Link for golangci-lint editor integration: https://golangci-lint.run/usage/integrations/
For VSCode, use these editor configuration flags:
"go.lintFlags": [
"--fast",
],
To set up a development environment for the UI
- Install go v1.17
- Install Node.js version 14.15.1
- Make sure your
$GOPATH
is added to your$PATH
in your bashrc or zshrc file, then install reflex for automated server builds: go get github.com/cespare/reflex - Go through the Weave GitOps getting started docs here: https://docs.gitops.weave.works/docs/getting-started/
- Run
make node_modules
. NOTE: Runningnpm install
could leave you unable to pass our ui-tests. If you're getting an error about a git diff in your package.lock, runrm -rf node_modules && make node_modules
. - Make sure GitOps is installed on a fresh kind cluster for this repo by running
kind delete cluster
,kind create cluster
, and finallygitops install
. - To start up the HTTP server with automated re-compliation, run
make api-dev
- Run
npm start
to start the frontend dev server (with hot-reloading)
Lint frontend code with make ui-lint
- using Prettier (https://prettier.io/) will get you on the right track!
Run frontend tests with make ui-test
- update CSS snapshots with npm run test -- -u
Check dependency vulnerabilities with make ui-audit
To avoid invalidating JWT tokens on every server restart set the GITOPS_JWT_ENCRYPTION_SECRET
env variable in your shell to use a static encryption secret. Else, a random encryption secret will be used that will change on every server (or pod) restart, thus invalidating any JWTs that were created with the old secret.
To create a new styled React component (with typescript):
{
"Export Default React Component": {
"prefix": "tsx",
"body": [
"import * as React from 'react';",
"import styled from 'styled-components'",
"",
"type Props = {",
" className?: string",
"}",
"",
"function ${1:} ({ className }: Props) {",
" return (",
" <div className={className}>",
" ${0}",
" </div>",
" );",
"}",
"",
"export default styled(${1:}).attrs({ className: ${1:}.name })``"
],
"description": "Create a default-exported, styled React Component."
}
}
Please see our Weave GitOps Core FAQ
Need help or want to contribute? Please see the links below.
- Getting Started?
- Follow our Get Started guide and give us feedback
- Need help?
- Talk to us in the #weave-gitops channel on Weaveworks Community Slack. Invite yourself if you haven't joined yet.
- Have feature proposals or want to contribute?
- Please create a Github issue