adds a kubernetes job that configures Forgejo
This commit is contained in:
parent
1a8c2846bc
commit
620f7a3fd9
1 changed files with 71 additions and 0 deletions
71
template/stacks/core/forgejo-sso/forgejo-sso-config.yaml
Normal file
71
template/stacks/core/forgejo-sso/forgejo-sso-config.yaml
Normal file
|
@ -0,0 +1,71 @@
|
|||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: forgejo-config
|
||||
namespace: gitea
|
||||
# annotations:
|
||||
# argocd.argoproj.io/hook: PostSync
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
generateName: forgejo-config-
|
||||
spec:
|
||||
# serviceAccountName: forgejo-config
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: push
|
||||
image: docker.io/library/ubuntu:22.04
|
||||
command: ["/bin/bash", "-c"]
|
||||
args:
|
||||
- |
|
||||
#! /bin/bash
|
||||
|
||||
apt -qq update
|
||||
apt -qq install git wget -y
|
||||
if [[ "$(uname -m)" == "x86_64" ]]; then
|
||||
wget https://github.com/mikefarah/yq/releases/download/v4.44.3/yq_linux_amd64
|
||||
install yq_linux_amd64 /usr/local/bin/yq
|
||||
rm yq_linux_amd64
|
||||
else
|
||||
wget https://github.com/mikefarah/yq/releases/download/v4.44.3/yq_linux_arm64
|
||||
install yq_linux_arm64 /usr/local/bin/yq
|
||||
rm yq_linux_arm64
|
||||
fi
|
||||
|
||||
DOMAIN=192-168-197-2.c-one-infra.de
|
||||
GIT_USERNAME=bot
|
||||
GIT_PASSWORD=ca78ba327f61588a564907638920d163936863c9
|
||||
|
||||
git config --global user.email "bot@bots.de"
|
||||
git config --global user.name "bot"
|
||||
|
||||
git clone https://${GIT_USERNAME}:${GIT_PASSWORD}@gitea-${DOMAIN}/giteaAdmin/edfbuilder.git
|
||||
cd edfbuilder
|
||||
yq eval ".gitea.oauth = [
|
||||
{
|
||||
\"name\": \"Keycloak\",
|
||||
\"provider\": \"openidConnect\",
|
||||
\"existingSecret\": \"auth-generic-oauth-secret\",
|
||||
\"autoDiscoverUrl\": \"https://${DOMAIN}/keycloak/realms/cnoe/.well-known/openid-configuration\"
|
||||
}
|
||||
] |
|
||||
(.gitea.oauth[] | .name) |= (. style=\"single\")
|
||||
|
|
||||
(.gitea.oauth[] | .provider) |= (. style=\"single\")
|
||||
|
|
||||
(.gitea.oauth[] | .existingSecret) |= (. style=\"single\")
|
||||
|
|
||||
(.gitea.oauth[] | .autoDiscoverUrl) |= (. style=\"single\")
|
||||
" -i stacks/core/forgejo/values.yaml
|
||||
|
||||
yq eval '.gitea.config.oauth2_client =
|
||||
{
|
||||
"ENABLE_AUTO_REGISTRATION" : true,
|
||||
"ACCOUNT_LINKING" : "auto"
|
||||
}
|
||||
' -i stacks/core/forgejo/values.yaml
|
||||
|
||||
git add stacks/core/forgejo/values.yaml
|
||||
git commit -m "adds Forgejo SSO config"
|
||||
git push
|
Loading…
Reference in a new issue