Coder Social home page Coder Social logo

adobe / aio-cli-lib-console Goto Github PK

View Code? Open in Web Editor NEW
4.0 23.0 9.0 188 KB

A library providing command line primitives to interract with the Adobe Developer Console.

Home Page: https://www.adobe.io

License: Apache License 2.0

JavaScript 100.00%
adobe-io adobe-io-cli adobe developer-console codegen aio cli

aio-cli-lib-console's People

Contributors

adamcin avatar amulyakashyap09 avatar arjuncooliitr avatar dependabot[bot] avatar florind12 avatar greenkeeper[bot] avatar himavanth avatar mariam21arauj avatar meryllblanchet avatar michaelgoberling avatar moritzraho avatar purplecabbage avatar sandeep-paliwal avatar shazron avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aio-cli-lib-console's Issues

Initial workspaces setup does not match a real life scenario: missing a "dev" workspace

As a developer / project creator, I can have 2 objectives when creating a project:

  1. I want an app very quickly deployed
  2. I want a full engineering setup (dev, test, prod) for a well-maintained application

Expected Behaviour

During the project creation, I should be offered either just 1 workspace (production for quick app deployment) or 3 workspaces (production, staging and dev for a clean setup matching also the CI/CD provided)

Actual Behaviour

When a project is created, 2 workspaces are proposed by default: production and staging.

If I did not follow a formal training or studied the doc, I do not change the workspace setup (= default is what I should need). Then when I use the cli to create the app and map it to my project, I am asked which workspace I should use: production or staging ?

  1. If I want an app very quickly deployed, I do not know what to do with the staging workspace.
  2. If I want a full engineering setup, either I know I am missing the dev workspace or I will select the staging which in the future will lead to confusion (how do I switch now to the dev workspace). Also in this scenario, the CI/CD proposed by default is great, but stagingandproductionare clearly not to be "touched" by a developer which makes thedev` workspace mandatory.

Conclusion: whatever is your objective, the initial workspaces setup does not match a real life scenario: either the project creator has to delete the staging workspace or add a required dev namespace.

cc @meryllblanchet

incorrect logic when creating enterprise credentials

These lines:

if (credentialType === LibConsoleCLI.OAUTH_SERVER_TO_SERVER_CREDENTIAL) {
credential = await this.getFirstOAuthServerToServerCredentials(orgId, project.id, workspace)
} else { // default is jwt
credential = await this.getFirstEntpCredentials(orgId, project.id, workspace)
}

When subscribing to a service with credential type OAuth S2S, we only search for existing credentials of type OAuth S2S (similarly for type JWT). If it doesn't exist for that specific type, we create one of that type.

What the logic should be is:
For an enterprise credential (either OAuth S2S or JWT), check whether there exists a credential of (type OAuth S2S OR type JWT). If no credential exists for either type, we create one of the specified type.

This similar to what is here (lib used to install templates): https://github.com/adobe/aio-lib-console-project-installation/blob/f3c43efded9a1c19c49021632bd9c604fcbb4c48/src/lib/configure-apis.js#L137-L153

Do not require prompts, support all operations via flags too

Expected Behaviour

CLIs should never require to prompt, to work also with non TTY environments (e.g. CICD).

This is also true for resource creation (create Workspace, Project, add services, ..).

For operations that require many inputs, consider using --input json input files

npm warnings

npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN [email protected] requires a peer of inquirer@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @adobe/[email protected] requires a peer of eslint-plugin-node@^10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @adobe/[email protected] requires a peer of eslint-plugin-jsdoc@^21.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] - 6.x but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.

Token validation issues, sometimes its valid, sometimes not

Expected Behaviour

The call to get info on the project ( via consoleApi succeeds, and we get the Production workspace.
Upon selecting Production further api calls fail.

Actual Behaviour

๐Ÿ”ฅ๐Ÿ aio app use

You are currently in:
1. Org: Adobe IO
2. Project: TwoExtensions
3. Workspace: Stage

? Switch to a new Adobe Developer Console configuration: B. Switch to another Workspace in the current Project
? Select Workspace: Production
โ  Retrieving services supported by the Organization... โ€บ   Error: [CoreConsoleAPISDK:ERROR_GET_SERVICES_FOR_ORG] 500 - Internal Server Error ({"id":"9a4760ca-c974-490d-ad0a-f45062f7b5aa"})
โ ‹ Retrieving services supported by the Organization...%                                                                                                  

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Environment Info

  System:
    OS: macOS 11.4
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Memory: 22.79 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.22.1 - ~/.nvm/versions/node/v12.22.1/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.20.1 - ~/.nvm/versions/node/v12.22.1/bin/npm
  Virtualization:
    Docker: 20.10.5 - /usr/local/bin/docker
  npmGlobalPackages:
    @adobe/aio-cli: 8.1.0

Sample Code that illustrates the problem

Logs taken while reproducing problem

Delete console.json from application folder if it is not necessary

When creating an app with aio app create, the console.json file is created and contains a lot of secrets. It is obvious that the file cannot be committed (which could potentially happen if you do not pay attention or not aware of the file content), and I have been told by @meryllblanchet that the file is useless anyway.

Expected Behaviour

The file is not there when the app has been created.

Actual Behaviour

The file is there, introduces a security risk and is confusing for the developer.

Rollback partially created resources in Console on error

If there is an error during execution and resources where created before, those should be deleted before throwing the error to leave a clean state.
For example, the user selects create new project which creates a new Console Project, a Stage Workspace and enables Runtime on the Production and Stage Workspace, now suppose there is an error when creating the Stage Workspace, then the User will be left with a partially created Project in Console that would need manual deltion

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.