0.0.1-alpha.0 โ€ข Published 6 months ago

@digital-ai/plugin-scaffolder-backend-module-digitalai-xlcli v0.0.1-alpha.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

@digital-ai/plugin-scaffolder-backend-module-digitalai-xlcli

๐Ÿš€ Digital.ai XL CLI Apply Actions

This Backstage software template actions enables applying configuration files to Digital.ai XL Deploy or XL Release using the xl apply command via the XL CLI.


๐Ÿงฉ What It Does

Based on user input, the template:

  • Determines whether to use XL Deploy or XL Release
  • Applies the specified configuration YAML file using the xl CLI
  • Uses credentials and host information from backstage app-config.yaml
  • Outputs the target environment URL after command success.

โš™๏ธ How It Works

This template uses a custom Backstage scaffolder action called xlcli:apply. The action:

  1. Locates the xl CLI binary
  2. Reads configuration values (host, username, password) using readValues
  3. Constructs the xl apply command dynamically
  4. Executes it and reports the result via Backstage scaffolder outputs

๐Ÿ“ Input Parameters

NameDescriptionRequired
productTarget product: xl-deploy or xl-releaseโœ… Yes
filePathPath to the configuration YAML file to be appliedโœ… Yes

Installation

From your Backstage instance root folder:

yarn add --cwd packages/backend @digital-ai/plugin-scaffolder-backend-module-digitalai-xlcli

This will download the right xl cli binary for the current operating system and architecture from the dist at https://dist.xebialabs.com/public/xl-cli/

This behavior can be customized by adding a new "xlcli" field in your packages/backend/package.json file, like so:

//packages/backend/package.json
{
  "xlcli": {   
    "version": "24.3.4",
    "skipDownload": false
  }
}

The custom actions used in this template require the xl CLI binary to function correctly.

If you choose to skip automatic downloading (using the xl.skipDownload option), make sure to satisfy one of the following conditions:

a. The path to the xl binary is explicitly configured in your app-config.yaml. (See configuration details below)

xlcli:
# When adding this plugin to your Backstage instance, it will automatically try to download the latest xl-cli binary and use it.
# But if you already have xl cli installed, you can override the path below.
  binaryPath: '/home/ishwarya/backstage/xl_test'

b. The xl CLI is already installed and available in the systemโ€™s global PATH on the machine running Backstage.

Configuration

  1. Import the actions into your packages/backend/src/index.ts Backend Plugin of your Backstage instance:
// packages/backend/src/index.ts
import scaffolderxlcliModule from "@digital-ai/plugin-scaffolder-backend-module-digitalai-xlcli";
const backend = createBackend();
// ....
backend.add(scaffolderxlcliModule);

Preview

Preview the xl-cli apply action in backstage.

Usage

Please refer the template xl-cli-github and xl-cli-yaml-inline for more details on how to use the xlcli apply action in the backstage template.

    - id: xlcliApply
      name: Apply xl-cli
      action: digitalai:xlcli:apply
      input:
        product: ${{ parameters.product }}
        releaseInstance: ${{ parameters.releaseInstance }}
        filePath: ${{ parameters.filePath }}