Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: move to new post-release steps #2206

Merged
merged 3 commits into from
Feb 11, 2022
Merged
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
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ GO_DEPENDENCIES = github.com/ory/go-acc \
github.com/golang/mock/mockgen \
github.com/go-swagger/go-swagger/cmd/swagger \
golang.org/x/tools/cmd/goimports \
github.com/mikefarah/yq \
github.com/mattn/goveralls \
github.com/cortesi/modd/cmd/modd

Expand All @@ -32,6 +31,10 @@ $(call make-lint-dependency)
echo "deprecated usage, use docs/cli instead"
go build -o .bin/clidoc ./cmd/clidoc/.

.PHONY: .bin/yq
.bin/yq:
go build -o .bin/yq github.com/mikefarah/yq/v4

.PHONY: docs/cli
docs/cli:
go run ./cmd/clidoc/. .
Expand Down Expand Up @@ -118,12 +121,12 @@ sdk: .bin/swagger .bin/ory node_modules
quickstart:
docker pull oryd/kratos:latest
docker pull oryd/kratos-selfservice-ui-node:latest
docker-compose -f quickstart.yml -f quickstart-standalone.yml up --build --force-recreate
quickstart -f quickstart.yml -f quickstart-standalone.yml up --build --force-recreate

.PHONY: quickstart-dev
quickstart-dev:
docker build -f .docker/Dockerfile-build -t oryd/kratos:latest .
docker-compose -f quickstart.yml -f quickstart-standalone.yml -f quickstart-latest.yml $(QUICKSTART_OPTIONS) up --build --force-recreate
quickstart -f quickstart.yml -f quickstart-standalone.yml -f quickstart-latest.yml $(QUICKSTART_OPTIONS) up --build --force-recreate

# Formats the code
.PHONY: format
Expand Down Expand Up @@ -169,3 +172,9 @@ migratest-refresh:
.PHONY: test-update-snapshots
test-update-snapshots:
UPDATE_SNAPSHOTS=true go test -p 4 -tags sqlite -short ./...

.PHONY: post-release
post-release: .bin/yq
cat quickstart.yml | yq '.services.kratos.image = "oryd/kratos:'$$DOCKER_TAG'"' | sponge quickstart.yml
cat quickstart.yml | yq '.services.kratos-migrate.image = "oryd/kratos:'$$DOCKER_TAG'"' | sponge quickstart.yml
cat quickstart.yml | yq '.services.kratos-selfservice-ui-node.image = "oryd/kratos-selfservice-ui-node:'$$DOCKER_TAG'"' | sponge quickstart.yml
3 changes: 1 addition & 2 deletions docs/docs/self-service/flows/code/registration/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ export const getFlowMethodOidcWithCompletion = {
browser: {
label: 'Browser UI',
image: require('./images/browser-oidc-invalid.png').default,
alt:
'User Registration HTML Form with missing or invalid fields when performing an OpenID Connect flow'
alt: 'User Registration HTML Form with missing or invalid fields when performing an OpenID Connect flow'
},
missing: {
label: 'Missing Website',
Expand Down
12 changes: 4 additions & 8 deletions docs/docs/self-service/flows/code/verification/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ export const getFlowMethodLinkWithErrors = {
browser: {
label: 'Browser UI',
image: require('./images/browser-missing.png').default,
alt:
'Email Verification and Account Activation HTML Form with validation errors'
alt: 'Email Verification and Account Activation HTML Form with validation errors'
},
missing: {
label: 'Missing Email',
Expand All @@ -16,8 +15,7 @@ export const getFlowMethodLinkSuccess = {
browser: {
label: 'Browser UI',
image: require('./images/browser-success.png').default,
alt:
'Email Verification and Account Activation HTML Form with success message'
alt: 'Email Verification and Account Activation HTML Form with success message'
},
missing: {
label: 'Email Sent',
Expand All @@ -30,8 +28,7 @@ export const getFlowMethodLinkInvalidChallenge = {
browser: {
label: 'Browser UI',
image: require('./images/browser-invalid-challenge.png').default,
alt:
'Email Verification and Account Activation HTML Form with an invalid challenge'
alt: 'Email Verification and Account Activation HTML Form with an invalid challenge'
},
missing: {
label: 'Invalid Challenge',
Expand All @@ -44,8 +41,7 @@ export const getFlowMethodLinkChallengeDone = {
browser: {
label: 'Browser UI',
image: require('./images/browser-challenge-completed.png').default,
alt:
'Email Verification and Account Activation HTML Form with an invalid challenge'
alt: 'Email Verification and Account Activation HTML Form with an invalid challenge'
},
missing: {
label: 'Success State',
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
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ require (
github.com/google/uuid v1.3.0
github.com/gorilla/sessions v1.2.1
github.com/gtank/cryptopasta v0.0.0-20170601214702-1f550f6f2f69
github.com/hashicorp/consul/api v1.5.0
github.com/hashicorp/consul/api v1.11.0
github.com/hashicorp/go-retryablehttp v0.7.0
github.com/hashicorp/golang-lru v0.5.4
github.com/imdario/mergo v0.3.12
Expand All @@ -65,6 +65,7 @@ require (
github.com/luna-duclos/instrumentedsql/opentracing v0.0.0-20201103091713-40d03108b6f4
github.com/mattn/goveralls v0.0.7
github.com/mikefarah/yq v1.15.0
github.com/mikefarah/yq/v4 v4.19.1
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe
github.com/ory/analytics-go/v4 v4.0.2
Expand All @@ -84,7 +85,7 @@ require (
github.com/rs/cors v1.8.0
github.com/sirupsen/logrus v1.8.1
github.com/slack-go/slack v0.7.4
github.com/spf13/cobra v1.2.1
github.com/spf13/cobra v1.3.0
github.com/spf13/pflag v1.0.5
github.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518
github.com/stretchr/testify v1.7.0
Expand All @@ -94,7 +95,7 @@ require (
github.com/zmb3/spotify/v2 v2.0.0
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
golang.org/x/net v0.0.0-20211020060615-d418f374d309
golang.org/x/oauth2 v0.0.0-20210810183815-faf39c7919d5
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/tools v0.1.7
)
Loading