From eaece17af0b751acc8b0c25a39a048e2eacd9647 Mon Sep 17 00:00:00 2001 From: Philipp Hugenroth Date: Mon, 20 Feb 2023 12:59:18 +0100 Subject: [PATCH] Remove GHA approach for now Signed-off-by: Philipp Hugenroth --- .../cli/src/commands/admin/auth/github/app.ts | 44 ------------------- .../src/commands/admin/auth/github/index.ts | 22 +--------- packages/cli/src/commands/admin/auth/index.ts | 4 +- 3 files changed, 4 insertions(+), 66 deletions(-) delete mode 100644 packages/cli/src/commands/admin/auth/github/app.ts diff --git a/packages/cli/src/commands/admin/auth/github/app.ts b/packages/cli/src/commands/admin/auth/github/app.ts deleted file mode 100644 index d78fe2a3d2..0000000000 --- a/packages/cli/src/commands/admin/auth/github/app.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2023 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import inquirer from 'inquirer'; -import { adminCli } from '../../../create-github-app'; -import { updateConfigFile, updateEnvFile } from '../config'; -import { APP_CONFIG_FILE, ENV_CONFIG_FILE } from '../files'; - -// TODO(tudi2d): Wrapper for admin CLI around `create-github-app` - potentially to be removed -export const app = async (useEnvForSecrets: boolean) => { - // TODO(tudi2d): Make the GitHub Org optional - const input = await inquirer.prompt<{ org: string }>([ - { - type: 'input', - name: 'org', - message: 'Enter a GitHub Org [required]', - }, - ]); - - const { auth } = await adminCli(input.org); - - // TODO(tudi2d): Also change integrations - await updateConfigFile(APP_CONFIG_FILE, { auth }); - if (useEnvForSecrets) { - await updateEnvFile( - ENV_CONFIG_FILE, - auth.providers.github.development.clientId, - auth.providers.github.development.clientSecret, - ); - } -}; diff --git a/packages/cli/src/commands/admin/auth/github/index.ts b/packages/cli/src/commands/admin/auth/github/index.ts index d140b98dd3..fa22cacef8 100644 --- a/packages/cli/src/commands/admin/auth/github/index.ts +++ b/packages/cli/src/commands/admin/auth/github/index.ts @@ -15,7 +15,6 @@ */ import inquirer from 'inquirer'; -import { app } from './app'; import { oauth } from './oauth'; export const github = async () => { @@ -29,26 +28,9 @@ export const github = async () => { message: 'Would you like to store sensitive configuration details such as secrets as environment variables? (recommended)', }, - { - type: 'list', - name: 'type', - message: 'Do you want to use a Github App or Github OAuth?', - choices: ['GitHub OAuth', 'GitHub App'], - }, ]); - const { type, useEnvForSecrets } = answers; + const { useEnvForSecrets } = answers; - switch (type) { - case 'GitHub OAuth': { - await oauth(useEnvForSecrets); - break; - } - case 'GitHub App': { - await app(useEnvForSecrets); - break; - } - default: - throw new Error(`Unknown selection: ${type}.`); - } + await oauth(useEnvForSecrets); }; diff --git a/packages/cli/src/commands/admin/auth/index.ts b/packages/cli/src/commands/admin/auth/index.ts index ce39748b09..ce8e55556b 100644 --- a/packages/cli/src/commands/admin/auth/index.ts +++ b/packages/cli/src/commands/admin/auth/index.ts @@ -27,14 +27,14 @@ export async function auth(): Promise { type: 'list', name: 'provider', message: 'Please select a provider:', - choices: ['Github'], + choices: ['GitHub'], }, ]); const { provider } = answers; switch (provider) { - case 'Github': { + case 'GitHub': { await github(); break; }