Skip to content

Commit

Permalink
Move to new SDK pipeline (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr authored Jan 13, 2020
1 parent ebe89ab commit 6940dc8
Show file tree
Hide file tree
Showing 346 changed files with 1,014 additions and 21,406 deletions.
59 changes: 18 additions & 41 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Golang CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-go/ for more details
version: 2
version: 2.1

orbs:
changelog: ory/[email protected]
sdk: ory/[email protected]

jobs:
format:
docker:
Expand Down Expand Up @@ -86,41 +88,9 @@ jobs:
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "ORY Continuous Integration"
- run: "git clone https://arekkas:[email protected]/ory/docs.git ../docs"
- run: "cp ./docs/api.swagger.json ../docs/apis/oathkeeper.json"
- run: "cp ./.schemas/config.schema.json ../docs/schemas/oathkeeper.config.schema.json"
- run: "(cd ../docs && git add -A && git commit -a -m \"Update ORY Oathkeeper Swagger and JSON Schemas\" && git push origin) || exit 0"

release-changelog:
docker:
- image: circleci/ruby:2.5-node
steps:
- checkout
- run: gem install github_changelog_generator -v 1.14.3
- run: sudo npm i -g doctoc
- run: github_changelog_generator -u ory -p oathkeeper -o CHANGELOG.md --token $GITHUB_TOKEN
- run: doctoc CHANGELOG.md
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "ORY Continuous Integration"
- run: git add CHANGELOG.md
- run: |
git commit -m "docs: Incorporates changes from version $(git describe --tags) [ci skip]" -- CHANGELOG.md
- run: git remote rm origin
- run: git remote add origin https://arekkas:[email protected]/ory/oathkeeper.git
- run: git push origin HEAD:master

release-npm:
docker:
- image: circleci/node:8.9.3
working_directory: ~/oathkeeper
steps:
- checkout
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
- run: |
npm version -f --no-git-tag-version $CIRCLE_TAG
- run: npm view ory-oathkeeper-sdk
- run: npm whoami
- run: npm publish

workflows:
version: 2
"test, build, and relase":
Expand All @@ -146,20 +116,27 @@ workflows:
only: /.*/
branches:
ignore: /.*/
- release-npm:
- changelog/generate:
requires:
- release
- test
- format
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- release-changelog:
only: master
- sdk/generate:
appname: Ory_Oathkeeper
requires:
- test
- format
- sdk/release:
requires:
- test
- format
- release
filters:
tags:
only: /.*/
branches:
only: master
ignore: /.*/
30 changes: 13 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
SHELL=/bin/bash -o pipefail

.PHONY: tools
tools:
GO111MODULE=on go install github.com/ory/go-acc github.com/ory/x/tools/listx github.com/go-swagger/go-swagger/cmd/swagger github.com/sqs/goreturns github.com/ory/sdk/swagutil

# Formats the code
.PHONY: format
format:
goreturns -w -local github.com/ory $$(listx .)
npm run format:docs

.PHONY: gen
gen: mocks sdk

# Generates the SDKs
.PHONY: sdk
sdk:
GO111MODULE=on go mod tidy
GO111MODULE=on go mod vendor
GO111MODULE=off swagger generate spec -m -o ./docs/api.swagger.json
GO111MODULE=off swagger validate ./docs/api.swagger.json

rm -rf ./sdk/go/oathkeeper/*
rm -rf ./sdk/js/swagger

GO111MODULE=off swagger generate client -f ./docs/api.swagger.json -t sdk/go/oathkeeper -A Ory_Oathkeeper

java -jar scripts/swagger-codegen-cli-2.2.3.jar generate -i ./docs/api.swagger.json -l javascript -o ./sdk/js/swagger

cd sdk/go; goreturns -w -i -local github.com/ory $$(listx .)
$$(go env GOPATH)/bin/swagger generate spec -m -o ./docs/api.swagger.json -x internal/httpclient
$$(go env GOPATH)/bin/swagutil sanitize ./docs/api.swagger.json
$$(go env GOPATH)/bin/swagger flatten --with-flatten=remove-unused -o ./docs/api.swagger.json ./docs/api.swagger.json
$$(go env GOPATH)/bin/swagger validate ./docs/api.swagger.json
rm -rf internal/httpclient
mkdir -p internal/httpclient
$$(go env GOPATH)/bin/swagger generate client -f ./docs/api.swagger.json -t internal/httpclient -A Ory_Oathkeeper
make format

rm -f ./sdk/js/swagger/package.json
rm -rf ./sdk/js/swagger/test
rm -rf ./vendor

.PHONY: install-stable
install-stable:
Expand Down
4 changes: 2 additions & 2 deletions api/rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import (
"github.com/ory/oathkeeper/x"

"github.com/ory/oathkeeper/internal"
"github.com/ory/oathkeeper/internal/httpclient/client"
sdkrule "github.com/ory/oathkeeper/internal/httpclient/client/api"
"github.com/ory/oathkeeper/rule"
"github.com/ory/oathkeeper/sdk/go/oathkeeper/client"
sdkrule "github.com/ory/oathkeeper/sdk/go/oathkeeper/client/api"
"github.com/ory/x/pointerx"

"github.com/stretchr/testify/assert"
Expand Down
5 changes: 3 additions & 2 deletions cmd/health_alive.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import (

"github.com/spf13/cobra"

"github.com/ory/oathkeeper/sdk/go/oathkeeper/client/api"
"github.com/ory/oathkeeper/internal/httpclient/client/health"

"github.com/ory/x/cmdx"
)

Expand All @@ -24,7 +25,7 @@ Note:
Run: func(cmd *cobra.Command, args []string) {
client := newClient(cmd)

r, err := client.API.IsInstanceAlive(api.NewIsInstanceAliveParams())
r, err := client.Health.IsInstanceAlive(health.NewIsInstanceAliveParams())
// If err, print err and exit 1
cmdx.Must(err, "%s", err)
// Print payload
Expand Down
5 changes: 3 additions & 2 deletions cmd/health_ready.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import (

"github.com/spf13/cobra"

"github.com/ory/oathkeeper/sdk/go/oathkeeper/client/api"
"github.com/ory/oathkeeper/internal/httpclient/client/health"

"github.com/ory/x/cmdx"
)

Expand All @@ -24,7 +25,7 @@ Note:
Run: func(cmd *cobra.Command, args []string) {
client := newClient(cmd)

r, err := client.API.IsInstanceReady(api.NewIsInstanceReadyParams())
r, err := client.Health.IsInstanceReady(health.NewIsInstanceReadyParams())
// If err, print err and exit 1
cmdx.Must(err, "%s", err)
// Print payload
Expand Down
2 changes: 1 addition & 1 deletion cmd/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

"github.com/spf13/cobra"

"github.com/ory/oathkeeper/sdk/go/oathkeeper/client"
"github.com/ory/oathkeeper/internal/httpclient/client"
"github.com/ory/x/cmdx"
"github.com/ory/x/flagx"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/rules_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

"github.com/spf13/cobra"

"github.com/ory/oathkeeper/sdk/go/oathkeeper/client/api"
"github.com/ory/oathkeeper/internal/httpclient/client/api"
"github.com/ory/x/cmdx"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/rules_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

"github.com/spf13/cobra"

"github.com/ory/oathkeeper/sdk/go/oathkeeper/client/api"
"github.com/ory/oathkeeper/internal/httpclient/client/api"
"github.com/ory/x/cmdx"
)

Expand Down
Loading

0 comments on commit 6940dc8

Please sign in to comment.