Skip to content
| Marketplace
Sign in
Azure DevOps>Azure Pipelines>Script Runner Kit
Script Runner Kit

Script Runner Kit

Alell Tech

|
8 installs
| (0) | Free
Script Runner Kit provides tasks to run multiple scripts.
Get it free

Script Runner

This extension provides tasks to run custom scripts like python and javascript!

  • NodeJsRunner
  • PythonRunner
  • TypeScriptRunner

Features

  • Execute python, javascript or typescript as shellscript alternative.
  • For typescript, you can enable integrated azure-devops-api library.

Usage sample

- job:
  ...
  steps:

  - task: PythonRunner@4
    inputs:
      script: |
        import glob, os
        proj = os.getenv('SYSTEM_TEAMPROJECT')
        repo = os.getenv('BUILD_REPOSITORY_NAME')

        set_variable('PROJECT_KEY', t'{proj}/{repo}')

        settings_xml = (
          glob.glob(
            '**/*settings.xml',
            recursive=True,
            include_hidden=True
          ) or ['']
        )[0]

        set_variable(
          'MAVEN_CUSTOM_SETTINGS',
          (settings_xml or '$HOME/.m2/settings.xml')
        )

  - task: NodeJsRunner@4
    inputs:
      script: |
        const {
          SYSTEM_TEAMPROJECT,
          BUILD_REPOSITORY_NAME
        } = process.env;

        set_variable('project_key', `${SYSTEM_TEAMPROJECT}/${BUILD_REPOSITORY_NAME}`);

  - task: TypeScriptRunner@4
    displayName: TS Class sample
    inputs:
      script: |- # typescript
        class Animal { constructor(public name: string){ }}
        class Cat extends Animal { }

        const cat = new Cat("Tom");
        set_variable('CAT_NAME', cat.name);

  - task: TypeScriptRunner@4
    displayName: TS using Azure API
    inputs:
      # Use this parameter to enable azure-devops-api connection,
      #   configure an "Generic Service Connection" on your organization
      #   https://learn.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=azure-devops#generic-service-connection
      azureDevOpsEndpoint: GenericDevOpsOrganizationEndpoint
      script: |- # typescript
        # connection variable has inserted on context
        # ⚠️ WARNING! Make Sure that your PAT get secure rights.

        const dashboards = await (await connection.getDashboardApi()).getDashboardsByProject({project: 'labs'});
        const projects = await (await connection.getCoreApi()).getProjects(undefined, 10);
        const repositories = await (await connection.getGitApi()).getRepositories(projects[0].name);
        const commit = await (await connection.getGitApi()).getCommits(repositories[0].id, {$top: 2});

        set_variable('dashboards', JSON.stringify(dashboards));
        set_variable('projects', JSON.stringify(projects));
        set_variable('repositories', JSON.stringify(repositories));
        set_variable('commit', JSON.stringify(commit));

        const { BUILD_REPOSITORY_ID, BUILD_SOURCEBRANCH } = process.env;
        const branch = (await (await connection.getGitApi()).getBranch(BUILD_REPOSITORY_ID, BUILD_SOURCEBRANCH))

        set_variable('branch', JSON.stringify(branch))

        let folder_contents = sh.ls();

Python x Pipeline Interchange built-in functions.

# Task Completion Functions
task_succeeded("Build completed successfully.")
# Output: ##vso[task.complete result=Succeeded]Build completed successfully.

task_failed("Build failed due to compilation errors.")
# Output: ##vso[task.complete result=Failed]Build failed due to compilation errors.

task_succeeded_with_issues("Build succeeded but with some warnings.")
# Output: ##vso[task.complete result=SucceededWithIssues]Build succeeded but with some warnings.

task_canceled("Build canceled by user.")
# Output: ##vso[task.complete result=Canceled]Build canceled by user.


# Logging Functions
log_error("An error occurred while processing the request.", sourcepath="script.py", linenumber=42)
# Output: ##vso[task.logissue type=error;sourcepath=script.py;linenumber=42]An error occurred while processing the request.

log_warning("This is a warning message.", columnnumber=15)
# Output: ##vso[task.logissue type=warning;columnnumber=15]This is a warning message.

log_debug("Debugging the application.")
# Output: ##vso[task.debug]Debugging the application.


# Variable Management Functions
set_variable("myVar", "myValue")
# Output: ##vso[task.setvariable variable=myVar]myValue

set_secret_variable("mySecret", "secretValue")
# Output: ##vso[task.setvariable variable=mySecret;issecret=true]secretValue

set_output_variable("myOutput", "outputValue")
# Output: ##vso[task.setvariable variable=myOutput;isOutput=true]outputValue

set_readonly_variable("myReadOnly", "readOnlyValue")
# Output: ##vso[task.setvariable variable=myReadOnly;isreadonly=true]readOnlyValue


# Artifact Handling Functions
upload_artifact("myArtifact", "path/to/myArtifact.zip")
# Output: ##vso[artifact.upload artifactname=myArtifact]path/to/myArtifact.zip

associate_artifact_container("myContainer", "path/to/container")
# Output: ##vso[artifact.associate artifactname=myContainer;type=container]path/to/container

upload_artifact_to_container("myArtifact", "container-folder", "path/to/myArtifact.zip")
# Output: ##vso[artifact.uploadcontainer artifactname=myArtifact;containerfolder=container-folder]path/to/myArtifact.zip


# Build Management Functions
add_build_tag("release")
# Output: ##vso[build.addbuildtag]release

update_build_number("1.0.0")
# Output: ##vso[build.updatebuildnumber]1.0.0

upload_build_log("build-log.txt")
# Output: ##vso[build.uploadlog]build-log.txt

upload_build_artifact("myArtifact", "path/to/artifact")
# Output: ##vso[build.uploadartifact artifactname=myArtifact;artifacttype=container]path/to/artifact


# Test Result Publishing Function
publish_test_results("JUnit", ["result1.xml", "result2.xml"], merge_results=True)
# Output: ##vso[results.publish type=JUnit;resultFiles=result1.xml,result2.xml;mergeResults=true]


# Cache Functions
restore_cache("myCacheKey", ["key1", "key2"])
# Output: ##vso[cache.restore key=myCacheKey;restoreKeys=key1,key2]

save_cache("myCacheKey", "path/to/cache")
# Output: ##vso[cache.save key=myCacheKey]path/to/cache


# Code Coverage Function
publish_code_coverage("coverlet", "coverage-summary.json", "coverage-report", ["additional1.json", "additional2.json"])
# Output: ##vso[codecoverage.publish tool=coverlet;summaryfile=coverage-summary.json;reportdirectory=coverage-report;additionalcodecoveragefiles=additional1.json,additional2.json]


# Packaging Functions
publish_package("npm", "my-package", "1.0.0", "path/to/package")
# Output: ##vso[artifacttool.publish type=npm;name=my-package;version=1.0.0]path/to/package

About US

Help us

See CONTRIBUTING.md

If you like our project help us to make more best solutions.

Bitcoin / network BTC:

1NvnQAp2e46Fqv4YaoYTioypJZdq4Kc3Az

Etherium / network Etherium:

0x38a2113604fb3d642bbd009301e94848a499cea4

BitTorrent / network Tron:

TD9LHa5BjWQpf4oP3uYWP8ghnojJWJy53C

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft