Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

changes to contacts proto are copied to apis repo #72

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/publish-proto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish Protobufs
on:
push:
branches:
- master
- main
- publishProtos # debug only, remove
paths:
- pkg/pb/contacts.proto
jobs:
test:
name: Publish Protobuf Changes
runs-on: ubuntu-latest
timeout-minutes: 5
defaults:
run:
working-directory: ./src/github.com/${{ github.repository }}
steps:
- uses: actions/checkout@v1
- uses: wilmol/copybara-action@v1
with:
git_name: wilmol
git_email: [email protected]
ssh_key: ${{ secrets.CODEBARABOT_DWELLS }}
ssh_known_hosts: ${{ secrets.CODEBARABOT_KNOWN_HOSTS }}
Comment on lines +22 to +25
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be accomplished with https and a Github PAT?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It only works with ssh

path: copy.bara.sky
8 changes: 1 addition & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@ services:
language: go

go:
- "1.10"

env:
- DEP_VERSION="0.4.1"
- "1.16"

before_install:
# add dep to the build environment
- curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o $GOPATH/bin/dep
- chmod +x $GOPATH/bin/dep

install:
# vendor the go dependencies
Expand Down
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,17 @@ test: fmt

.PHONY: test-with-integration
test-with-integration: fmt
@go test $(GO_TEST_FLAGS) -tags=integration $(GO_PACKAGES)
go test $(GO_TEST_FLAGS) -tags=integration $(GO_PACKAGES)

.PHONY: docker
docker:
@docker build -f $(SERVER_DOCKERFILE) -t $(SERVER_IMAGE):$(IMAGE_VERSION) .
@docker tag $(SERVER_IMAGE):$(IMAGE_VERSION) $(SERVER_IMAGE):latest
@docker image prune -f --filter label=stage=server-intermediate
docker build -f $(SERVER_DOCKERFILE) -t $(SERVER_IMAGE):$(IMAGE_VERSION) .
docker tag $(SERVER_IMAGE):$(IMAGE_VERSION) $(SERVER_IMAGE):latest
docker image prune -f --filter label=stage=server-intermediate

.PHONY: push
push:
@docker push $(SERVER_IMAGE)
docker push $(SERVER_IMAGE)

.PHONY: protobuf
protobuf:
Expand Down
11 changes: 6 additions & 5 deletions cmd/server/grpc.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package main

import (
"github.com/grpc-ecosystem/go-grpc-middleware"
"github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus"
toolkit_auth "github.com/infobloxopen/atlas-app-toolkit/auth"
"github.com/infobloxopen/atlas-app-toolkit/errors"
"github.com/infobloxopen/atlas-app-toolkit/errors/mappers/validationerrors"
"github.com/infobloxopen/atlas-app-toolkit/gateway"
"github.com/infobloxopen/atlas-app-toolkit/requestid"
"github.com/infobloxopen/atlas-contacts-app/cmd"
grpc_opa "github.com/infobloxopen/atlas-authz-middleware/grpc_opa"
"github.com/infobloxopen/atlas-contacts-app/pkg/pb"
"github.com/infobloxopen/atlas-contacts-app/pkg/svc"

grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpc_logrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/postgres"
"github.com/sirupsen/logrus"
Expand All @@ -26,10 +26,11 @@ func NewGRPCServer(logger *logrus.Logger, db *gorm.DB) (*grpc.Server, error) {
validationerrors.UnaryServerInterceptor(),
gateway.UnaryServerInterceptor(),
}

// add authorization interceptor if authz service address is provided
if AuthzAddr != "" {
// authorization interceptor
interceptors = append(interceptors, toolkit_auth.UnaryServerInterceptor(AuthzAddr, cmd.ApplicationID))
interceptors = append(interceptors, grpc_opa.UnaryServerInterceptor("contacts"))
}

// create new gRPC grpcServer with middleware chain
Expand Down
16 changes: 6 additions & 10 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
package main

import (
"database/sql"
"flag"
"net"

"github.com/jinzhu/gorm"
"github.com/sirupsen/logrus"

"fmt"
"net"
"net/http"
"time"

"database/sql"

"github.com/infobloxopen/atlas-app-toolkit/gateway"
"github.com/infobloxopen/atlas-app-toolkit/gorm/resource"
"github.com/infobloxopen/atlas-app-toolkit/health"
"github.com/infobloxopen/atlas-app-toolkit/server"
"github.com/infobloxopen/atlas-contacts-app/cmd"
"github.com/infobloxopen/atlas-contacts-app/pkg/pb"

grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/grpc-ecosystem/go-grpc-middleware"

"github.com/jinzhu/gorm"
"github.com/sirupsen/logrus"
"google.golang.org/grpc"
)

Expand Down Expand Up @@ -137,7 +133,7 @@ func ServeExternal(logger *logrus.Logger) error {
gateway.WithGatewayOptions(
runtime.WithMetadata(gateway.NewPresenceAnnotator("PUT")),
),
gateway.WithDialOptions(
gateway.WithDialOptions(
[]grpc.DialOption{grpc.WithInsecure(), grpc.WithUnaryInterceptor(
grpc_middleware.ChainUnaryClient(
[]grpc.UnaryClientInterceptor{gateway.ClientUnaryInterceptor, gateway.PresenceClientInterceptor()}...,
Expand Down
23 changes: 23 additions & 0 deletions copy.bara.sky
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
core.workflow(
name = "default",
origin = git.github_origin(
url = "https://github.com/infobloxopen/atlas-contacts-app.git",
ref = "master",
),
destination = git.destination(
url = "https://github.com/infobloxopen/apis.git",
fetch = "main",
push = "main",
),

origin_files = glob(["pkg/pb/*.proto"]),

# Copy everything but don't remove a README_INTERNAL.txt file if it exists.
destination_files = glob(["atlas/example/contacts/**"], exclude = []),

authoring = authoring.pass_thru("Codebara <[email protected]>"),

transformations = [
core.move("pkg/pb", "atlas/example/contacts/v1")
],
)
24 changes: 24 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module github.com/infobloxopen/atlas-contacts-app

go 1.16

require (
github.com/bitly/go-simplejson v0.5.0
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
github.com/dgrijalva/jwt-go v3.2.1-0.20200107013213-dc14462fd587+incompatible
github.com/gogo/protobuf v1.3.1 // indirect
github.com/golang/protobuf v1.4.3
github.com/grpc-ecosystem/go-grpc-middleware v1.2.2
github.com/grpc-ecosystem/grpc-gateway v1.14.8
github.com/infobloxopen/atlas-app-toolkit v0.24.1
github.com/infobloxopen/atlas-authz-middleware v0.0.0-20210225225130-c605434fa6f3
github.com/infobloxopen/protoc-gen-gorm v0.20.1
github.com/jinzhu/gorm v1.9.16
github.com/kr/pretty v0.2.0 // indirect
github.com/lyft/protoc-gen-validate v0.0.13
github.com/sirupsen/logrus v1.8.0
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11
google.golang.org/genproto v0.0.0-20200806141610-86f49bd18e98
google.golang.org/grpc v1.34.0
google.golang.org/grpc/examples v0.0.0-20210408231144-1d1bbb55b381 // indirect
)
Loading