Code Monkey home page Code Monkey logo

aio-cli-plugin-aem-rde's Introduction

aio-cli-plugin-aem-rde

Adobe I/O CLI Plugin for interactions with AEM Rapid Development Environments.

Requirements

  • Adobe I/O CLI
  • Node.js version compatibility:
    • 16.x -- 16.13.0 or higher.
    • 18.x -- 18.0.0 or higher.
    • 20.x -- 20.11.0 or higher.
    • Use with odd Node versions is not recommended.

Installation

$ aio plugins:install @adobe/aio-cli-plugin-aem-rde

Updating

$ aio plugins:update

Getting started

Configuration to be used in command line

The plugin needs to be configured to point to an existing RDE environment. To do so, the organization, program and environment must be configured accordingly. As a user, use below command to do so.

$ aio login
$ aio aem:rde:setup

The setup command offers the following functionality:

  • Change from one program/environment to another.
  • Display the previously active configuration when changed.
  • Store the configuration locally in a .aio file in the current folder. This allows to setup a config for each RDE independently.
  • Switch organization by aio logout and then use the setup command again.

Note: Working with multiple environments: it is highly recommended to use the local storage. For details on different config locations refer to aio-lib-core-config's README. However, the default is to use global for users who have one environment only.

Configuration to be used in build environments

For build environments, include below into the scripts.

 $ aio config:set cloudmanager_orgid <org-id>
 $ aio config:set cloudmanager_programid <program-id>
 $ aio config:set cloudmanager_environmentid <env-id>

Note: Working with multiple environments: it is highly recommend to use the flag -l or --local together with the config:set so that the configuration is stored in the local directory (i.e. the config is only effective in the current directory). For details on different config locations refer to aio-lib-core-config's README.

Configuration for aio aem rde inspect commands *

⚠️ * WARNING: This is an experimental feature! It may not work, may not (yet) be available and may be removed without notice. ⚠️

Enable aio aem rde inspect commands

If you want to enable this experimental feature, run the following command:

$ aio config set -l -j aem-rde.experimental-features '["aem:rde:inspect"]'

This command creates a local configuration file .aio that contains the information to activate the experimental feature.

Verifying configuration

  1. Run aio aem:rde for general help.
  2. Run aio aem:rde:status to see if the configured environment can be accessed.
  3. Run aio aem:rde:install --help for help about a specific command.
  4. Run aio aem:rde:logs --help to see options for tailing logs.

Only if inspect topic is enabled:

  1. Run aio aem:rde:inspect --help to see if the inspect command can be accessed.

Running unit tests

  1. Run npm run test

This both runs the mocha-based unit tests as well as produces a test report table at the end. A more detailed test report can be found in the coverage/index.html file.

Steps for testing local modifications

  1. Clone this repository to a folder.
  2. Run npm install in the folder.
  3. Run aio plugins:link . inside your folder.

Exit Codes

Primarily for scripting application purposes, the following exit codes are used:

  • 1 - A generic (non-catch) error has occurred
  • 2 - A configuration error has occurred
  • 3 - A validation error with the supplied flags or arguments has occurred
  • 4 - A deployment error has occurred
  • 5 - An internal error that might be fixed with a retry has occurred
  • 40 - An error emanating from the deployment not being fully performed has occurred. This error might be interpretable by some users as ok if that's a middle step they need to go through

Releasing a new version

Please read the RELEASE.md

aio-cli-plugin-aem-rde's People

Contributors

angulito avatar bosschaert avatar jsedding avatar karlpauls avatar kwin avatar maciejzurekk avatar nonanalou avatar remoliechti avatar royteeuwen avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aio-cli-plugin-aem-rde's Issues

Improve log tailing and colorize log messages

The output of tailing logs is currently very choppy, because a batch of log lines is fetched every 1500ms and dumped onto the console in one go. When using the real "tail" command, lines are output as they arrive, which makes the output feel more fluid, and easier to track with the eyes. This ticket aims at achieving this effect.

Different colors for log lines of different severities would also be nice.

Conflicting requirements in package.json

In the package.json I see the following requirements (

):

"engines": {
    "npm": "^8.0.0",
    "node": "^16.13 || >=18"
  },

This leads to warning during installation, as newer versions of node (e.g. the latest LTS) ship with NPM 9.x. (https://nodejs.org/en/download/releases/):

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@adobe/[email protected]',
npm WARN EBADENGINE   required: { npm: '^8.0.0', node: '^16.13 || >=18' },
npm WARN EBADENGINE   current: { node: 'v19.6.0', npm: '9.4.0' }
npm WARN EBADENGINE }

I think that adding a requirement on the node version is sufficient.

Allow the reset command to be executed in the background

Expected Behaviour

Triggering the aio aem:rde reset command in a CI / CD pipeline is commonly the last command to be executed. The build status could already be set to succeeded or failed independently of the reset of the environment. It should be possible to trigger a reset without waiting for the finishing of that reset

Actual Behaviour

Currently the reset command is always blocking

Plugins handles status code insufficiently

Some API endpoints return status code 404 in case an ID was not found.
In example:
$ aio aem rde inspect inventory foobar
which then results in an API error message, which it actually is not.

› Error: [RDECLI:UNEXPECTED_API_ERROR] There was an unexpected API error code 404 with message Not Found. Please, try again later and if the error persists, report it. › Code: UNEXPECTED_API_ERROR

Check all API calls (when provided with an ID) to be handled correctly.

Set and document exit codes

Similar to adobe/aio-cli-plugin-cloudmanager#215 all commands should indicate failures also via the exit code in order to ease using the commands in automation scripts. Currently failures just lead to log messages (e.g. in

} catch (err) {
progressBar.stop();
spinner.stop();
if (err instanceof String && err.endsWith('Concurrent modification')) {
cli.log(
'Your RDE is waiting for the upload of a previous invocation of the "install" command.'
);
cli.log('You can ignore this by using the "--force" flag.');
} else {
cli.log(err);
}
}
).)

It would be good to reuse the exit code categories defined in https://github.com/adobe/aio-cli-plugin-cloudmanager#exit-codes.

Set error exit code (!= 0) for "Error: 403 - Forbidden"

When I call e.g. aem:rde:reset I get back the output Error: 403 - Forbidden however the CLI exits with the success exit code (0). In case of errors always indicate that with an exit code != 0 to ease automatically evaluating the outcome. This is related to #18 .

Update dependencies

Update dependencies to latest compatible versions and allow the use of modern node js versions.

Log login exception with context "aio-cli-plugin-cloudmanager"

Currently the code in getTokenAndKey silently catches all exceptions and falls back to the context cli.
That makes it close to impossible to debug issues with the context aio-cli-plugin-cloudmanager. Therefore I would suggest the following:

Only fall back to cli if there is no config at all for aio-cli-plugin-cloudmanager and pass the original exception to the caller otherwise.

Allow the status to be exported as json

We would like to use the RDE env in a CI / CD environment, where we need to know if the environment is available before installing a next package.

The aem:rde:status is a textual description, it is non-parseable for an automated system.

Feature request:

  • Add a json output for the status command

Pull Request action fails to check out code if branch is on a fork

If you look at #27, you'll see that the git checkout fails, with the following.

  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/SKYOPS-46671*:refs/remotes/origin/SKYOPS-46671* +refs/tags/SKYOPS-46671*:refs/tags/SKYOPS-46671*
  The process '/usr/bin/git' failed with exit code 1

That change is on a branch on a fork

#28 is the same change but then on a 'local' branch where it works.

So the PR action doesn't work if the branch is on a fork.

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.