mirror of
https://github.com/goauthentik/authentik
synced 2026-04-25 17:15:26 +02:00
root: move API client generation to docker-compose (#17434)
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
committed by
GitHub
parent
296b348bd2
commit
d91dcf4eef
1
.github/dependabot.yml
vendored
1
.github/dependabot.yml
vendored
@@ -146,6 +146,7 @@ updates:
|
|||||||
- package-ecosystem: docker-compose
|
- package-ecosystem: docker-compose
|
||||||
directories:
|
directories:
|
||||||
# - /scripts # Maybe
|
# - /scripts # Maybe
|
||||||
|
- /scripts/api
|
||||||
- /tests/e2e
|
- /tests/e2e
|
||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: daily
|
||||||
|
|||||||
55
Makefile
55
Makefile
@@ -149,14 +149,13 @@ gen-changelog: ## (Release) generate the changelog based from the commits since
|
|||||||
npx prettier --write changelog.md
|
npx prettier --write changelog.md
|
||||||
|
|
||||||
gen-diff: ## (Release) generate the changelog diff between the current schema and the last tag
|
gen-diff: ## (Release) generate the changelog diff between the current schema and the last tag
|
||||||
git show $(shell git describe --tags $(shell git rev-list --tags --max-count=1)):schema.yml > old_schema.yml
|
git show $(shell git describe --tags $(shell git rev-list --tags --max-count=1)):schema.yml > schema-old.yml
|
||||||
docker run \
|
docker compose -f scripts/api/docker-compose.yml run --rm --user "${UID}:${GID}" diff \
|
||||||
--rm -v ${PWD}:/local \
|
--markdown \
|
||||||
--user ${UID}:${GID} \
|
/local/diff.md \
|
||||||
docker.io/openapitools/openapi-diff:2.1.0-beta.8 \
|
/local/schema-old.yml \
|
||||||
--markdown /local/diff.md \
|
/local/schema.yml
|
||||||
/local/old_schema.yml /local/schema.yml
|
rm schema-old.yml
|
||||||
rm old_schema.yml
|
|
||||||
sed -i 's/{/{/g' diff.md
|
sed -i 's/{/{/g' diff.md
|
||||||
sed -i 's/}/}/g' diff.md
|
sed -i 's/}/}/g' diff.md
|
||||||
npx prettier --write diff.md
|
npx prettier --write diff.md
|
||||||
@@ -165,28 +164,21 @@ gen-clean-ts: ## Remove generated API client for TypeScript
|
|||||||
rm -rf ${PWD}/${GEN_API_TS}/
|
rm -rf ${PWD}/${GEN_API_TS}/
|
||||||
rm -rf ${PWD}/web/node_modules/@goauthentik/api/
|
rm -rf ${PWD}/web/node_modules/@goauthentik/api/
|
||||||
|
|
||||||
gen-clean-go: ## Remove generated API client for Go
|
|
||||||
mkdir -p ${PWD}/${GEN_API_GO}
|
|
||||||
ifneq ($(wildcard ${PWD}/${GEN_API_GO}/.*),)
|
|
||||||
make -C ${PWD}/${GEN_API_GO} clean
|
|
||||||
else
|
|
||||||
rm -rf ${PWD}/${GEN_API_GO}
|
|
||||||
endif
|
|
||||||
|
|
||||||
gen-clean-py: ## Remove generated API client for Python
|
gen-clean-py: ## Remove generated API client for Python
|
||||||
rm -rf ${PWD}/${GEN_API_PY}/
|
rm -rf ${PWD}/${GEN_API_PY}
|
||||||
|
|
||||||
|
gen-clean-go: ## Remove generated API client for Go
|
||||||
|
rm -rf ${PWD}/${GEN_API_GO}
|
||||||
|
|
||||||
gen-clean: gen-clean-ts gen-clean-go gen-clean-py ## Remove generated API clients
|
gen-clean: gen-clean-ts gen-clean-go gen-clean-py ## Remove generated API clients
|
||||||
|
|
||||||
gen-client-ts: gen-clean-ts ## Build and install the authentik API for Typescript into the authentik UI Application
|
gen-client-ts: gen-clean-ts ## Build and install the authentik API for Typescript into the authentik UI Application
|
||||||
docker run \
|
docker compose -f scripts/api/docker-compose.yml run --rm --user "${UID}:${GID}" gen \
|
||||||
--rm -v ${PWD}:/local \
|
generate \
|
||||||
--user ${UID}:${GID} \
|
|
||||||
docker.io/openapitools/openapi-generator-cli:v7.15.0 generate \
|
|
||||||
-i /local/schema.yml \
|
-i /local/schema.yml \
|
||||||
-g typescript-fetch \
|
-g typescript-fetch \
|
||||||
-o /local/${GEN_API_TS} \
|
-o /local/${GEN_API_TS} \
|
||||||
-c /local/scripts/api-ts-config.yaml \
|
-c /local/scripts/api/ts-config.yaml \
|
||||||
--additional-properties=npmVersion=${NPM_VERSION} \
|
--additional-properties=npmVersion=${NPM_VERSION} \
|
||||||
--git-repo-id authentik \
|
--git-repo-id authentik \
|
||||||
--git-user-id goauthentik
|
--git-user-id goauthentik
|
||||||
@@ -196,17 +188,14 @@ gen-client-ts: gen-clean-ts ## Build and install the authentik API for Typescri
|
|||||||
cd ${PWD}/web && npm link @goauthentik/api
|
cd ${PWD}/web && npm link @goauthentik/api
|
||||||
|
|
||||||
gen-client-py: gen-clean-py ## Build and install the authentik API for Python
|
gen-client-py: gen-clean-py ## Build and install the authentik API for Python
|
||||||
docker run \
|
mkdir -p ${PWD}/${GEN_API_PY}
|
||||||
--rm -v ${PWD}:/local \
|
ifeq ($(wildcard ${PWD}/${GEN_API_PY}/.*),)
|
||||||
--user ${UID}:${GID} \
|
git clone --depth 1 https://github.com/goauthentik/client-python.git ${PWD}/${GEN_API_PY}
|
||||||
docker.io/openapitools/openapi-generator-cli:v7.15.0 generate \
|
else
|
||||||
-i /local/schema.yml \
|
cd ${PWD}/${GEN_API_PY} && git pull
|
||||||
-g python \
|
endif
|
||||||
-o /local/${GEN_API_PY} \
|
cp ${PWD}/schema.yml ${PWD}/${GEN_API_PY}
|
||||||
-c /local/scripts/api-py-config.yaml \
|
make -C ${PWD}/${GEN_API_PY} build version=${NPM_VERSION}
|
||||||
--additional-properties=packageVersion=${NPM_VERSION} \
|
|
||||||
--git-repo-id authentik \
|
|
||||||
--git-user-id goauthentik
|
|
||||||
|
|
||||||
gen-client-go: gen-clean-go ## Build and install the authentik API for Golang
|
gen-client-go: gen-clean-go ## Build and install the authentik API for Golang
|
||||||
mkdir -p ${PWD}/${GEN_API_GO}
|
mkdir -p ${PWD}/${GEN_API_GO}
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
additionalProperties:
|
|
||||||
packageName: authentik_client
|
|
||||||
projectName: authentik-client
|
|
||||||
infoName: authentik Team
|
|
||||||
15
scripts/api/docker-compose.yml
Normal file
15
scripts/api/docker-compose.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
services:
|
||||||
|
diff:
|
||||||
|
image: docker.io/openapitools/openapi-diff:2.1.3
|
||||||
|
restart: never
|
||||||
|
network_mode: none
|
||||||
|
volumes:
|
||||||
|
- ../../:/local
|
||||||
|
|
||||||
|
gen:
|
||||||
|
image: docker.io/openapitools/openapi-generator-cli:v7.16.0
|
||||||
|
restart: never
|
||||||
|
network_mode: none
|
||||||
|
volumes:
|
||||||
|
- ../../:/local
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
templateDir: /local/scripts/api-ts-templates/
|
templateDir: /local/scripts/api/ts-templates/
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
typescriptThreePlus: true
|
typescriptThreePlus: true
|
||||||
supportsES6: true
|
supportsES6: true
|
||||||
Reference in New Issue
Block a user