Skip to content

Commit

Permalink
feat: migrate odpf to goto (#2)
Browse files Browse the repository at this point in the history
* feat: migrate odpf to goto

* feat: fix docs acton

* fix: gotocompany namesapces

* readme: fix typo

* fix: buf-gen validation plugin

---------

Co-authored-by: Muhammad Abduh <[email protected]>
Co-authored-by: Ishan Arya <[email protected]>
  • Loading branch information
3 people authored Mar 16, 2023
1 parent 96d2530 commit 7f2d04a
Show file tree
Hide file tree
Showing 183 changed files with 3,680 additions and 4,102 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
push: true
file: "./Dockerfile.dev"
tags: |
odpf/shield:dev
gotocompany/shield:dev
6 changes: 3 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:
run: cd docs && yarn build
- name: Deploy docs
env:
GIT_USER: ravisuhag
GIT_USER: anshuman-gojek
GIT_PASS: ${{ secrets.DOCU_RS_TOKEN }}
DEPLOYMENT_BRANCH: gh-pages
CURRENT_BRANCH: master
working-directory: docs
run: |
git config --global user.email "suhag.ravi@gmail.com"
git config --global user.name "ravisuhag"
git config --global user.email "anshuman.srivastava@gojek.com"
git config --global user.name "anshuman-gojek"
yarn deploy
28 changes: 14 additions & 14 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ builds:
flags:
- -a
ldflags:
- -s -w -X github.com/odpf/shield/config.Version={{.Tag}}
- -X github.com/odpf/shield/config.BuildCommit={{.FullCommit}}
- -X github.com/odpf/shield/config.BuildDate={{.Date}}
- -s -w -X github.com/goto/shield/config.Version={{.Tag}}
- -X github.com/goto/shield/config.BuildCommit={{.FullCommit}}
- -X github.com/goto/shield/config.BuildDate={{.Date}}
goos: [linux, darwin, windows]
goarch: [amd64, arm, arm64]
env:
Expand Down Expand Up @@ -47,13 +47,13 @@ dockers:
- shield
dockerfile: Dockerfile
image_templates:
- "docker.io/odpf/{{.ProjectName}}:latest"
- "docker.io/odpf/{{.ProjectName}}:{{ .Version }}"
- "docker.io/odpf/{{.ProjectName}}:{{ .Tag }}-amd64"
- "docker.io/gotocompany/{{.ProjectName}}:latest"
- "docker.io/gotocompany/{{.ProjectName}}:{{ .Version }}"
- "docker.io/gotocompany/{{.ProjectName}}:{{ .Tag }}-amd64"
nfpms:
- maintainer: ODPF
- maintainer: gotocompany
description: Identity and authorization system
homepage: https://github.com/odpf/shield
homepage: https://github.com/goto/shield
license: Apache 2.0
formats:
- deb
Expand All @@ -62,17 +62,17 @@ nfpms:
darwin: macOS
scoop:
bucket:
owner: odpf
owner: goto
name: scoop-bucket
homepage: "https://github.com/odpf/shield"
homepage: "https://github.com/goto/shield"
description: "Identity and authorization system"
license: Apache 2.0
brews:
- name: shield
homepage: "https://github.com/odpf/shield"
homepage: "https://github.com/goto/shield"
description: "Identity and authorization system"
tap:
owner: odpf
owner: goto
name: homebrew-tap
license: "Apache 2.0"
folder: Formula
Expand All @@ -81,5 +81,5 @@ brews:
install: |-
bin.install "shield"
commit_author:
name: Ravi Suhag
email: suhag.ravi@gmail.com
name: github-actions[bot]
email: 41898282+github-actions[bot]@users.noreply.github.com
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ GOVERSION := $(shell go version | cut -d ' ' -f 3 | cut -d '.' -f 2)

.PHONY: build check fmt lint test test-race vet test-cover-html help install proto
.DEFAULT_GOAL := build
PROTON_COMMIT := "e75b207d66a407eea8b5ead75e25f9bd074c4148"
PROTON_COMMIT := "5b5dc727b525925bcec025b355983ca61d7ccf68"

install:
@echo "Clean up imports..."
Expand Down Expand Up @@ -32,7 +32,7 @@ e2e-regression-test: ## Run regression tests
go test -v -race ./test/e2e_test/regression -coverprofile=coverage.out

benchmark: ## Run benchmarks
go test -run=XX -bench=Benchmark. -count 3 -benchtime=1s github.com/odpf/shield/integration
go test -run=XX -bench=Benchmark. -count 3 -benchtime=1s github.com/goto/shield/integration

coverage: ## print code coverage
go test -race -coverprofile coverage.out -covermode=atomic ./... -tags=unit_test && go tool cover -html=coverage.txt
Expand All @@ -41,10 +41,10 @@ clean :
rm -rf dist

proto: ## Generate the protobuf files
@echo " > generating protobuf from odpf/proton"
@echo " > generating protobuf from goto/proton"
@echo " > [info] make sure correct version of dependencies are installed using 'make install'"
@buf generate https://github.com/odpf/proton/archive/${PROTON_COMMIT}.zip#strip_components=1 --template buf.gen.yaml --path odpf/shield
@cp -R proto/odpf/shield/* proto/ && rm -Rf proto/odpf
@buf generate https://github.com/goto/proton/archive/${PROTON_COMMIT}.zip#strip_components=1 --template buf.gen.yaml --path gotocompany/shield
@cp -R proto/gotocompany/shield/* proto/ && rm -Rf proto/gotocompany
@echo " > protobuf compilation finished"

help:
Expand Down
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Shield

![build workflow](https://github.com/odpf/shield/actions/workflows/test.yml/badge.svg)
![package workflow](https://github.com/odpf/shield/actions/workflows/release.yml/badge.svg)
![build workflow](https://github.com/goto/shield/actions/workflows/test.yml/badge.svg)
![package workflow](https://github.com/goto/shield/actions/workflows/release.yml/badge.svg)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?logo=apache)](LICENSE)
[![Version](https://img.shields.io/github/v/release/odpf/shield?logo=semantic-release)](Version)
[![Coverage Status](https://coveralls.io/repos/github/odpf/shield/badge.svg?branch=main)](https://coveralls.io/github/odpf/shield?branch=main)
[![Version](https://img.shields.io/github/v/release/goto/shield?logo=semantic-release)](Version)
[![Coverage Status](https://coveralls.io/repos/github/goto/shield/badge.svg?branch=main)](https://coveralls.io/github/goto/shield?branch=main)

Shield is a cloud native role-based authorization aware server and reverse-proxy system. With Shield, you can assign roles to users or groups of users to configure policies that determine whether a particular user has the ability to perform a certain action on a given resource.

Expand All @@ -30,20 +30,20 @@ Discover why users choose Shield as their authorization proxy

## Installation

Install Shield on macOS, Windows, Linux, OpenBSD, FreeBSD, and on any machine. Refer this for [installations](https://odpf.github.io/shield/docs/installation).
Install Shield on macOS, Windows, Linux, OpenBSD, FreeBSD, and on any machine. Refer this for [installations](https://goto.github.io/shield/docs/installation).

#### Binary (Cross-platform)

Download the appropriate version for your platform from [releases](https://github.com/odpf/shield/releases) page. Once downloaded, the binary can be run from anywhere.
Download the appropriate version for your platform from [releases](https://github.com/goto/shield/releases) page. Once downloaded, the binary can be run from anywhere.
You don’t need to install it into a global location. This works well for shared hosts and other systems where you don’t have a privileged account.
Ideally, you should install it somewhere in your PATH for easy use. `/usr/local/bin` is the most probable location.

#### macOS

`shield` is available via a Homebrew Tap, and as downloadable binary from the [releases](https://github.com/odpf/shield/releases/latest) page:
`shield` is available via a Homebrew Tap, and as downloadable binary from the [releases](https://github.com/goto/shield/releases/latest) page:

```sh
brew install odpf/tap/shield
brew install goto/tap/shield
```

To upgrade to the latest version:
Expand All @@ -60,14 +60,14 @@ shield version

#### Linux

`shield` is available as downloadable binaries from the [releases](https://github.com/odpf/shield/releases/latest) page. Download the `.deb` or `.rpm` from the releases page and install with `sudo dpkg -i` and `sudo rpm -i` respectively.
`shield` is available as downloadable binaries from the [releases](https://github.com/goto/shield/releases/latest) page. Download the `.deb` or `.rpm` from the releases page and install with `sudo dpkg -i` and `sudo rpm -i` respectively.

#### Windows

`shield` is available via [scoop](https://scoop.sh/), and as a downloadable binary from the [releases](https://github.com/odpf/shield/releases/latest) page:
`shield` is available via [scoop](https://scoop.sh/), and as a downloadable binary from the [releases](https://github.com/goto/shield/releases/latest) page:

```
scoop bucket add shield https://github.com/odpf/scoop-bucket.git
scoop bucket add shield https://github.com/goto/scoop-bucket.git
```

To upgrade to the latest version:
Expand All @@ -81,20 +81,20 @@ scoop update shield
We provide ready to use Docker container images. To pull the latest image:

```
docker pull odpf/shield:latest
docker pull gotocompany/shield:latest
```

To pull a specific version:

```
docker pull odpf/shield:v0.3.2
docker pull gotocompany/shield:v0.3.2
```

If you like to have a shell alias that runs the latest version of shield from docker whenever you type `shield`:

```
mkdir -p $HOME/.config/odpf
alias shield="docker run -e HOME=/tmp -v $HOME/.config/odpf:/tmp/.config/odpf --user $(id -u):$(id -g) --rm -it -p 3306:3306/tcp odpf/shield:latest"
mkdir -p $HOME/.config/gotocompany
alias shield="docker run -e HOME=/tmp -v $HOME/.config/gotocompany:/tmp/.config/gotocompany --user $(id -u):$(id -g) --rm -it -p 3306:3306/tcp gotocompany/shield:latest"
```

## Usage
Expand All @@ -119,7 +119,7 @@ shield reference

#### API

Shield provides a fully-featured GRPC and HTTP API to interact with Shield server. Both APIs adheres to a set of standards that are rigidly followed. Please refer to [proton](https://github.com/odpf/proton/tree/main/odpf/shield/v1beta1) for GRPC API definitions.
Shield provides a fully-featured GRPC and HTTP API to interact with Shield server. Both APIs adheres to a set of standards that are rigidly followed. Please refer to [proton](https://github.com/goto/proton/tree/main/goto/shield/v1beta1) for GRPC API definitions.

## Running locally

Expand All @@ -135,7 +135,7 @@ Shield provides a fully-featured GRPC and HTTP API to interact with Shield serve
Clone the repo

```
git clone [email protected]:odpf/shield.git
git clone [email protected]:goto/shield.git
```

Install all the golang dependencies
Expand Down Expand Up @@ -184,14 +184,14 @@ $ make coverage
Development of Shield happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and
improvements. Read below to learn how you can take part in improving Shield.

Read our [contributing guide](https://odpf.github.io/shield/docs/contribute/contribution) to learn about our development process, how to propose
Read our [contributing guide](https://goto.github.io/shield/docs/contribute/contribution) to learn about our development process, how to propose
bugfixes and improvements, and how to build and test your changes to Shield.

To help you get your feet wet and get you familiar with our contribution process, we have a list of
[good first issues](https://github.com/odpf/shield/labels/good%20first%20issue) that contain bugs which have a relatively
[good first issues](https://github.com/goto/shield/labels/good%20first%20issue) that contain bugs which have a relatively
limited scope. This is a great place to get started.

This project exists thanks to all the [contributors](https://github.com/odpf/shield/graphs/contributors).
This project exists thanks to all the [contributors](https://github.com/goto/shield/graphs/contributors).

## License

Expand Down
8 changes: 5 additions & 3 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ plugins:
- remote: "buf.build/library/plugins/go-grpc:v1.1.0-2"
out: "proto"
opt: "paths=source_relative"
- remote: buf.build/odpf/plugins/validate
out: "proto"
opt: "paths=source_relative,lang=go"
- remote: buf.build/jirkad/plugins/protoc-gen-validate:v0.6.7
out: proto
opt:
- paths=source_relative
- lang=go
- remote: "buf.build/grpc-ecosystem/plugins/grpc-gateway:v2.5.0-1"
out: "proto"
opt: "paths=source_relative"
Expand Down
6 changes: 3 additions & 3 deletions cmd/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"os"

"github.com/MakeNowJust/heredoc"
"github.com/odpf/salt/printer"
"github.com/odpf/shield/pkg/file"
shieldv1beta1 "github.com/odpf/shield/proto/v1beta1"
"github.com/goto/salt/printer"
"github.com/goto/shield/pkg/file"
shieldv1beta1 "github.com/goto/shield/proto/v1beta1"
cli "github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"errors"
"testing"

"github.com/odpf/shield/cmd"
"github.com/goto/shield/cmd"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"time"

shieldv1beta1 "github.com/odpf/shield/proto/v1beta1"
shieldv1beta1 "github.com/goto/shield/proto/v1beta1"
"github.com/spf13/cobra"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
Expand Down
2 changes: 1 addition & 1 deletion cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"

"github.com/MakeNowJust/heredoc"
"github.com/odpf/salt/cmdx"
"github.com/goto/salt/cmdx"
"github.com/spf13/cobra"
)

Expand Down
6 changes: 3 additions & 3 deletions cmd/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"os"

"github.com/MakeNowJust/heredoc"
"github.com/odpf/salt/printer"
"github.com/odpf/shield/pkg/file"
shieldv1beta1 "github.com/odpf/shield/proto/v1beta1"
"github.com/goto/salt/printer"
"github.com/goto/shield/pkg/file"
shieldv1beta1 "github.com/goto/shield/proto/v1beta1"
cli "github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"errors"
"testing"

"github.com/odpf/shield/cmd"
"github.com/goto/shield/cmd"
"github.com/stretchr/testify/assert"
)

Expand Down
6 changes: 3 additions & 3 deletions cmd/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import "github.com/MakeNowJust/heredoc"
var envHelp = map[string]string{
"short": "List of supported environment variables",
"long": heredoc.Doc(`
ODPF_CONFIG_DIR: the directory where shield will store configuration files. Default:
"$XDG_CONFIG_HOME/odpf" or "$HOME/.config/odpf".
GOTOCOMPANY_CONFIG_DIR: the directory where shield will store configuration files. Default:
"$XDG_CONFIG_HOME/gotocompany" or "$HOME/.config/gotocompany".
NO_COLOR: set to any value to avoid printing ANSI escape sequences for color output.
CLICOLOR: set to "0" to disable printing ANSI colors in output.
`),
Expand All @@ -17,6 +17,6 @@ var authHelp = map[string]string{
"long": heredoc.Doc(`
Send an additional flag header with "key:value" format.
Example:
shield create user -f user.yaml -H X-Shield-Email:user@odpf.io
shield create user -f user.yaml -H X-Shield-Email:user@gotocompany.com
`),
}
6 changes: 3 additions & 3 deletions cmd/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"os"

"github.com/MakeNowJust/heredoc"
"github.com/odpf/salt/printer"
"github.com/odpf/shield/pkg/file"
shieldv1beta1 "github.com/odpf/shield/proto/v1beta1"
"github.com/goto/salt/printer"
"github.com/goto/shield/pkg/file"
shieldv1beta1 "github.com/goto/shield/proto/v1beta1"
cli "github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"errors"
"testing"

"github.com/odpf/shield/cmd"
"github.com/goto/shield/cmd"
"github.com/stretchr/testify/assert"
)

Expand Down
6 changes: 3 additions & 3 deletions cmd/organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"os"

"github.com/MakeNowJust/heredoc"
"github.com/odpf/salt/printer"
"github.com/odpf/shield/pkg/file"
shieldv1beta1 "github.com/odpf/shield/proto/v1beta1"
"github.com/goto/salt/printer"
"github.com/goto/shield/pkg/file"
shieldv1beta1 "github.com/goto/shield/proto/v1beta1"
cli "github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/organization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"errors"
"testing"

"github.com/odpf/shield/cmd"
"github.com/goto/shield/cmd"
"github.com/stretchr/testify/assert"
)

Expand Down
6 changes: 3 additions & 3 deletions cmd/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"os"

"github.com/MakeNowJust/heredoc"
"github.com/odpf/salt/printer"
"github.com/odpf/shield/pkg/file"
shieldv1beta1 "github.com/odpf/shield/proto/v1beta1"
"github.com/goto/salt/printer"
"github.com/goto/shield/pkg/file"
shieldv1beta1 "github.com/goto/shield/proto/v1beta1"
cli "github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"errors"
"testing"

"github.com/odpf/shield/cmd"
"github.com/goto/shield/cmd"
"github.com/stretchr/testify/assert"
)

Expand Down
Loading

0 comments on commit 7f2d04a

Please sign in to comment.