Skip to main content

A tool to extract and list variables from Azure Pipeline YAML files

Project description

Azure Pipeline Variable List

Test

A tool to analyze and list variables used in Azure Pipeline YAML files.

English | 中文

功能说明

一个用于分析和列出 Azure Pipeline YAML 文件中使用的变量的工具。

功能特点

  • 检测 $(VARIABLE) 格式的变量
  • 识别变量组中定义的变量
  • 支持嵌套目录结构
  • 支持 .yml.yaml 文件扩展名

例如,如果你有一个 demo.yml 流水线文件,内容如下:

...
variables:
  group: infra
  ## - var1
  ## - var2
  ## - var3

stages:
  - stage: Build
    jobs:
      - job: Build
        steps:
          - script: echo $(var1)
...

azpipvar 将输出:

demo.yml:
  - var1 (by variable group)

使用说明:

## - var3

这是一个注释,告诉工具 var3 是在变量组中定义的,或者是在 Azure DevOps 流水线的变量中定义的(未存储在代码仓库中)。

该工具将列出流水线文件中使用的所有变量,并显示它们是否在变量组中定义。

这个工具可以帮助你找到流水线文件中所有未预定义的变量。


Features

  • Detects variables in $(VARIABLE) format
  • Identifies variables defined in variable groups
  • Supports nested directory structures
  • Handles both .yml and .yaml file extensions

For example, if you have a pipeline file demo.yml like this:

...
variables:
  group: infra
  ## - var1
  ## - var2
  ## - var3

stages:
  - stage: Build
    jobs:
      - job: Build
        steps:
          - script: echo $(var1)
...

azpipvar will output:

demo.yml:
  - var1 (by variable group)

Let me explain the usage:

## - var3

This is a comment, that tells the tool that var3 is defined in a variable group or just defined in the variables of the azure devops pipeline(which is not stored in repository).

It will list all variables used in the pipeline files and show whether they are defined in variable groups or not.

This tool can help you find all variables used in the pipeline files that is not predefined.

Requirements

  • Python 3.8 or higher
  • PyYAML 6.0.1 or higher

Installation

You can install the package using pip:

pip install azpipvar

To help us improve the package by sharing anonymous installation statistics:

pip install azpipvar --install-option="--no-track-install"

Note: The installation tracking is completely optional and transparent. When enabled:

  • A single GET request is made to count the installation
  • No personal or system information is collected
  • Failed tracking attempts will not affect installation
  • The tracking server timeout is set to 2 seconds

For development installation from source:

git clone https://github.com/greatbody/macpy-scripts.git
cd macpy-scripts
pip install -e .

Usage

Navigate to your Azure Pipelines directory and run:

azpipvar

This will scan all YAML files in the current directory and subdirectories, listing all variables used in the pipeline files.

License

This project is licensed under the MIT License.

Author

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

azpipvar-0.1.5.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

azpipvar-0.1.5-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file azpipvar-0.1.5.tar.gz.

File metadata

  • Download URL: azpipvar-0.1.5.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for azpipvar-0.1.5.tar.gz
Algorithm Hash digest
SHA256 78f31e3234c32d359132c496107cd5f483662c1cd92f43bed39112de4810d839
MD5 588c3333f567dec5934e2b1067d6c3fe
BLAKE2b-256 e133f1dfea05e04700a992c861278f2742733ba37484d16ae71280293fa86010

See more details on using hashes here.

File details

Details for the file azpipvar-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: azpipvar-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for azpipvar-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 00c289bd45af9b327361e6c2686b58c1d757adfa641f4132fec990ddebfacdb8
MD5 a323a91bf465a1fd4881cfa0bd823a42
BLAKE2b-256 d881657f964e533d132dd146a3baacb55e56bc4b2bb0337bbd96615255384871

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page