Skip to content

Commit

Permalink
ci: resolve regression issues (#881)
Browse files Browse the repository at this point in the history
  • Loading branch information
jnodorp-jaconi committed Dec 13, 2021
1 parent 62ebb22 commit 30ff27f
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 99 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2.1

orbs:
sdk: ory/sdk@0.1.43
sdk: ory/sdk@0.1.52
changelog: ory/changelog@0.1.10
goreleaser: ory/goreleaser@0.1.34
slack: circleci/slack@3.4.2
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# To compile this image manually run:
#
# $ make docker
FROM alpine:3.14.2
FROM alpine:3.15.0

RUN apk add -U --no-cache ca-certificates

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-alpine
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# To compile this image manually run:
#
# $ make docker
FROM alpine:3.14.2
FROM alpine:3.15.0

RUN addgroup -S ory; \
adduser -S ory -G ory -D -H -s /bin/nologin
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ gen:
mocks sdk

.bin/ory: Makefile
bash <(curl https://raw.githubusercontent.com/ory/cli/master/install.sh) -b .bin v0.0.53
bash <(curl https://raw.githubusercontent.com/ory/meta/master/install.sh) -b .bin v0.0.53
touch -a -m .bin/ory

# Generates the SDKs
Expand Down
156 changes: 79 additions & 77 deletions docs/scripts/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,98 +45,100 @@ if (process.argv.length !== 3 || process.argv[1] === 'help') {

const config = require(path.resolve(process.argv[2]))

const enhance = (schema, parents = []) => (item) => {
const key = item.key.value

const path = [
...parents.map((parent) => ['properties', parent]),
['properties', key]
].flat()

if (['title', 'description'].find((f) => path[path.length - 1] === f)) {
return
}
const enhance =
(schema, parents = []) =>
(item) => {
const key = item.key.value

const path = [
...parents.map((parent) => ['properties', parent]),
['properties', key]
].flat()

if (['title', 'description'].find((f) => path[path.length - 1] === f)) {
return
}

const comments = [`# ${pathOr(key, [...path, 'title'], schema)} ##`, '']
const comments = [`# ${pathOr(key, [...path, 'title'], schema)} ##`, '']

const description = pathOr('', [...path, 'description'], schema)
if (description) {
comments.push(' ' + description.split('\n').join('\n '), '')
}
const description = pathOr('', [...path, 'description'], schema)
if (description) {
comments.push(' ' + description.split('\n').join('\n '), '')
}

const defaultValue = pathOr('', [...path, 'default'], schema)
if (defaultValue || defaultValue === false) {
comments.push(' Default value: ' + defaultValue, '')
}
const defaultValue = pathOr('', [...path, 'default'], schema)
if (defaultValue || defaultValue === false) {
comments.push(' Default value: ' + defaultValue, '')
}

const enums = pathOr('', [...path, 'enum'], schema)
if (enums && Array.isArray(enums)) {
comments.push(
' One of:',
...YAML.stringify(enums)
.split('\n')
.map((i) => ` ${i}`)
) // split always returns one empty object so no need for newline
}
const enums = pathOr('', [...path, 'enum'], schema)
if (enums && Array.isArray(enums)) {
comments.push(
' One of:',
...YAML.stringify(enums)
.split('\n')
.map((i) => ` ${i}`)
) // split always returns one empty object so no need for newline
}

const min = pathOr('', [...path, 'minimum'], schema)
if (min || min === 0) {
comments.push(` Minimum value: ${min}`, '')
}
const min = pathOr('', [...path, 'minimum'], schema)
if (min || min === 0) {
comments.push(` Minimum value: ${min}`, '')
}

const max = pathOr('', [...path, 'maximum'], schema)
if (max || max === 0) {
comments.push(` Maximum value: ${max}`, '')
}
const max = pathOr('', [...path, 'maximum'], schema)
if (max || max === 0) {
comments.push(` Maximum value: ${max}`, '')
}

const examples = pathOr('', [...path, 'examples'], schema)
if (examples) {
comments.push(
' Examples:',
...YAML.stringify(examples)
.split('\n')
.map((i) => ` ${i}`)
) // split always returns one empty object so no need for newline
}
const examples = pathOr('', [...path, 'examples'], schema)
if (examples) {
comments.push(
' Examples:',
...YAML.stringify(examples)
.split('\n')
.map((i) => ` ${i}`)
) // split always returns one empty object so no need for newline
}

let hasChildren
if (item.value.items) {
item.value.items.forEach((item) => {
if (item.key) {
enhance(schema, [...parents, key])(item)
hasChildren = true
}
})
}
let hasChildren
if (item.value.items) {
item.value.items.forEach((item) => {
if (item.key) {
enhance(schema, [...parents, key])(item)
hasChildren = true
}
})
}

const showEnvVarBlockForObject = pathOr(
'',
[...path, 'showEnvVarBlockForObject'],
schema
)
if (!hasChildren || showEnvVarBlockForObject) {
const env = [...parents, key].map((i) => i.toUpperCase()).join('_')
comments.push(
' Set this value using environment variables on',
' - Linux/macOS:',
` $ export ${env}=<value>`,
' - Windows Command Line (CMD):',
` > set ${env}=<value>`,
''
const showEnvVarBlockForObject = pathOr(
'',
[...path, 'showEnvVarBlockForObject'],
schema
)

// Show this if the config property is an object, to call out how to specify the env var
if (hasChildren) {
if (!hasChildren || showEnvVarBlockForObject) {
const env = [...parents, key].map((i) => i.toUpperCase()).join('_')
comments.push(
' This can be set as an environment variable by supplying it as a JSON object.',
' Set this value using environment variables on',
' - Linux/macOS:',
` $ export ${env}=<value>`,
' - Windows Command Line (CMD):',
` > set ${env}=<value>`,
''
)

// Show this if the config property is an object, to call out how to specify the env var
if (hasChildren) {
comments.push(
' This can be set as an environment variable by supplying it as a JSON object.',
''
)
}
}
}

item.commentBefore = comments.join('\n')
item.spaceBefore = true
}
item.commentBefore = comments.join('\n')
item.spaceBefore = true
}

new Promise((resolve, reject) => {
parser.dereference(
Expand Down
26 changes: 14 additions & 12 deletions docs/src/theme/CodeFromRemote.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,23 @@ const findLine = (needle, haystack) => {
return index
}

const transform = ({ startAt, endAt }) => (content) => {
let lines = content.split('\n')
const transform =
({ startAt, endAt }) =>
(content) => {
let lines = content.split('\n')

const startIndex = findLine(startAt, lines)
if (startIndex > 0) {
lines = ['// ...', ...lines.slice(startIndex, -1)]
}
const startIndex = findLine(startAt, lines)
if (startIndex > 0) {
lines = ['// ...', ...lines.slice(startIndex, -1)]
}

const endIndex = findLine(endAt, lines)
if (endIndex > 0) {
lines = [...lines.slice(0, endIndex + 1), '// ...']
}
const endIndex = findLine(endAt, lines)
if (endIndex > 0) {
lines = [...lines.slice(0, endIndex + 1), '// ...']
}

return lines.join('\n')
}
return lines.join('\n')
}

const CodeFromRemote = (props) => {
const { src, title } = props
Expand Down
3 changes: 2 additions & 1 deletion docs/src/theme/ketoRelationTuplesPrism.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export default (prism) =>
(prism.languages['keto-relation-tuples'] = {
comment: /\/\/.*(\n|$)/,
'relation-tuple': {
pattern: /([^:#@()\n]+:)?([^:#@()\n]+)#([^:#@()\n]+)@?((\(([^:#@()\n]+:)?([^:#@()\n]+)#([^:#@()\n]*)\))|([^:#@()\n]+))/,
pattern:
/([^:#@()\n]+:)?([^:#@()\n]+)#([^:#@()\n]+)@?((\(([^:#@()\n]+:)?([^:#@()\n]+)#([^:#@()\n]*)\))|([^:#@()\n]+))/,
inside: {
namespace,
object,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
github.com/form3tech-oss/jwt-go v3.2.2+incompatible
github.com/fsnotify/fsnotify v1.4.9
github.com/ghodss/yaml v1.0.0
github.com/go-openapi/errors v0.19.6
github.com/go-openapi/errors v0.20.1
github.com/go-openapi/runtime v0.19.20
github.com/go-openapi/strfmt v0.19.5
github.com/go-openapi/swag v0.19.9
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,9 @@ github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQH
github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0=
github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94=
github.com/go-openapi/errors v0.19.3/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94=
github.com/go-openapi/errors v0.19.6 h1:xZMThgv5SQ7SMbWtKFkCf9bBdvR2iEyw9k3zGZONuys=
github.com/go-openapi/errors v0.19.6/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M=
github.com/go-openapi/errors v0.20.1 h1:j23mMDtRxMwIobkpId7sWh7Ddcx4ivaoqUbfXx5P+a8=
github.com/go-openapi/errors v0.20.1/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M=
github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4=
github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4=
github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/ory/fosite"
"github.com/ory/oathkeeper/driver/configuration"
"github.com/ory/viper"
"github.com/ory/x/logrusx"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestCache(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion test/reload/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ waitport 6061

function finish {
cat ./config.yaml
cat ./rules.3.json
cat ./rules.3.json || true
cat ./oathkeeper.log
}
trap finish EXIT
Expand Down

0 comments on commit 30ff27f

Please sign in to comment.