Skip to content

mihai-vlc/sfcc-jobs-executor

Repository files navigation

SFCC Jobs Executor

Run SFCC jobs from VSCode and view the job logs in the output panel.

screenshot

Features

  • Read the job id from the comments on the active file
  • Read a specific job using a keyboard shortcut
  • Show the job execution logs in the output window
  • Manage and run jobs from a dedicated panel
  • Apply regex transformation rules to the job output logs

Installation

You can install it from the marketplace.
ext install ionutvmi.sfcc-jobs-executor

Configuration

The job configurations can be controlled from the dedicated panel: job configuration panel

The transformations can be controlled from the dedicated panel: job configuration panel

Logs transformations

The log transformations are a set of regular expressions replace patterns that are applied before printing the text in the output panel.
The enabled rules have a checkmark before their name.
The rules are applied in the order they are listed in the panel.
The sorting is done by the position attribute.

The regex is applied with the global modifier enabled.

Business Manager

Administration > Site Development > Open Commerce API Settings
Data - Global

{
  "clients": [
    {
      "allowed_origins": [],
      "client_id": "",
      "resources": [
        {
          "resource_id": "/jobs/{job_id}/executions",
          "read_attributes": "(**)",
          "write_attributes": "(**)",
          "methods": ["post"]
        },
        {
          "resource_id": "/jobs/{job_id}/executions/{id}",
          "read_attributes": "(**)",
          "write_attributes": "(**)",
          "methods": ["get"]
        }
      ]
    }
  ]
}

Administration > Organization > WebDAV Client Permissions

{
  "clients": [
    {
      "client_id": "",
      "permissions": [
        {
          "path": "/Logs",
          "operations": ["read"]
        }
      ]
    }
  ]
}

In the VSCode workspace

// dw.json file
{
  "hostname": "",
  "username": "",
  "password": "",
  "client-id": "",
  "client-secret": ""
}

If you are using access tokens and you want to use a dedicated one for this extension:

{
  "hostname": "",
  "bm-username": "",
  "bm-password": "",
  "client-id": "",
  "client-secret": ""
}

If you don't need to have support for debugging you can use the following minimal configuration:

  "hostname": "",
  "client-id": "",
  "client-secret": ""
// In any file you can specify the job id and timeout
//   The job id should be last in the configuration list.

// @sfccJobTailLogTimeout 60000
// @sfccJobClearLog
// @sfccJobId 000-test-job

// or jsdoc style

/**
 * @sfccJobTailLogTimeout 60000
 * @sfccJobClearLog
 * @sfccJobId 000-test-job
 */

Keyboard shortcuts

To configure a custom keyboard shortcut:

// keybindings.json
// run the job from the current file
{
  "key": "ctrl+shift+f6",
  "command": "sfcc-jobs-executor.runJob"
}

// run a specific job regardless of the current file
{
    "key": "ctrl+shift+f6",
    "command": "sfcc-jobs-executor.runJob",
    "args": {
        "job": {
            "id": "000-test-job",
            "timeout": 60000,
            "clearLog": true
        }
    }
}

Release Notes

The release notes are available in the CHANGELOG.md document.


Author

Mihai Ionut Vilcu

Enjoy!

About

Execute SFCC jobs from VSCode.

Resources

License

Stars

10 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors