Skip to content

Commit

Permalink
Merge pull request #193 from jordigilh/fix/capture_github_client_in_s…
Browse files Browse the repository at this point in the history
…etup

Capture GitHub client {Id,Secret} in hack/setup.sh
  • Loading branch information
masayag authored May 21, 2024
2 parents 1649b58 + 464935b commit 33a76b5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/orchestrator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.32
version: 0.2.33

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
28 changes: 28 additions & 0 deletions hack/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,26 @@ function captureGitToken {
fi
}

function captureGitClientId {
if [ -z "$GITHUB_CLIENT_ID" ]; then
read -s -p "Enter GitHub client ID (empty for disabling it): " value
echo ""
GITHUB_CLIENT_ID=$value
else
echo "GitHub client ID already set."
fi
}

function captureGitClientSecret {
if [ -z "$GITHUB_CLIENT_SECRET" ]; then
read -s -p "Enter GitHub client secret (empty for disabling it): " value
echo ""
GITHUB_CLIENT_SECRET=$value
else
echo "GitHub client secret already set."
fi
}

function captureArgoCDNamespace {
default="orchestrator-gitops"
if [ "$use_default" == true ]; then
Expand Down Expand Up @@ -150,6 +170,12 @@ function createBackstageSecret {
if [ -n "$GITHUB_TOKEN" ]; then
secretKeys[GITHUB_TOKEN]=$GITHUB_TOKEN
fi
if [ -n "$GITHUB_CLIENT_ID" ]; then
secretKeys[GITHUB_CLIENT_ID]=$GITHUB_CLIENT_ID
fi
if [ -n "$GITHUB_CLIENT_SECRET" ]; then
secretKeys[GITHUB_CLIENT_SECRET]=$GITHUB_CLIENT_SECRET
fi
cmd="oc create secret generic backstage-backend-auth-secret -n rhdh-operator --from-literal=BACKEND_SECRET=$BACKEND_SECRET"
for key in "${!secretKeys[@]}"; do
cmd="${cmd} --from-literal=${key}=${secretKeys[$key]}"
Expand Down Expand Up @@ -213,6 +239,8 @@ function main {
captureK8sURL
generateK8sToken
captureGitToken
captureGitClientId
captureGitClientSecret
captureArgoCDNamespace
captureArgoCDURL
captureArgoCDCreds
Expand Down

0 comments on commit 33a76b5

Please sign in to comment.