Skip to content

Commit

Permalink
test: gitea operator
Browse files Browse the repository at this point in the history
  • Loading branch information
ferruhcihan committed Aug 19, 2024
1 parent c3440d4 commit a272099
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/operator/gitea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ async function setGiteaOIDCConfig(update = false) {
const clientID = env.oidcClientId
const clientSecret = env.oidcClientSecret
const discoveryURL = `${env.oidcEndpoint}/.well-known/openid-configuration`
const teamNamespaceString = buildTeamString(env.teamNames)

try {
const execCommand = [
Expand All @@ -503,7 +504,7 @@ async function setGiteaOIDCConfig(update = false) {
AUTH_ID=$(gitea admin auth list --vertical-bars | grep -E "\\|otomi-idp\\s+\\|" | grep -iE "\\|OAuth2\\s+\\|" | awk -F " " '{print $1}' | tr -d '\\n')
if [ -z "$AUTH_ID" ]; then
echo "Gitea OIDC config not found. Adding OIDC config for otomi-idp."
gitea admin auth add-oauth --name "otomi-idp" --key "${clientID}" --secret "${clientSecret}" --auto-discover-url "${discoveryURL}" --provider "openidConnect" --admin-group "team-admin" --group-claim-name "groups"
gitea admin auth add-oauth --name "otomi-idp" --key "${clientID}" --secret "${clientSecret}" --auto-discover-url "${discoveryURL}" --provider "openidConnect" --admin-group "team-admin" --group-claim-name "groups" --group-team-map '${teamNamespaceString}'
elif ${update}; then
echo "Gitea OIDC config is different. Updating OIDC config for otomi-idp."
gitea admin auth update-oauth --id "$AUTH_ID" --key "${clientID}" --secret "${clientSecret}" --auto-discover-url "${discoveryURL}"
Expand Down

0 comments on commit a272099

Please sign in to comment.