watson / ci-info

Get details about the current Continuous Integration environment
MIT License
319 stars 49 forks source link

Uses `TF_BUILD` in vendors.json #116

Closed jessehouwing closed 11 months ago

jessehouwing commented 11 months ago

See: https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml

TF_BUILD - Set to True if the script is being run by a build task.

This variable is agent-scoped, and can be used as an environment variable in a script and as a parameter in a build task, but not as part of the build number or as a version control tag.

BUILD_REASON - The event that caused the build to run.

  • PullRequest: The build was triggered by a Git branch policy that requires a build.
jrdodds commented 11 months ago

From a comment in another PR, it seems this is the more correct approach (versus #115).

sibiraj-s commented 11 months ago

Thank you @jessehouwing . Can you add/fix tests as well? here https://github.com/watson/ci-info/blob/master/test.js#L126

jessehouwing commented 11 months ago

I'll nave to take a look, can't be too hard. Famous last words.

On Tue, 3 Oct 2023, 15:34 Sibiraj, @.***> wrote:

@.**** requested changes on this pull request.

Changes Looks good.

Will merge and publish by tomorrow once tests are fixed

— Reply to this email directly, view it on GitHub https://github.com/watson/ci-info/pull/116#pullrequestreview-1655231084, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA724S4AYC4MWTBLEDCDI3LX5QH6HAVCNFSM6AAAAAA5P7XWCKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTMNJVGIZTCMBYGQ . You are receiving this because you were mentioned.Message ID: @.***>

jrdodds commented 11 months ago

It seems like the setup and teardown of the environment variables in the 'Azure Pipelines - PR' and 'Azure Pipelines - Not PR' tests needs to be updated. Looks straight-forward.

jessehouwing commented 11 months ago

Also tested in actual Azure Pipelines Build and PR:

Starting: CmdLine
==============================================================================
Task         : Command line
Description  : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
Version      : 2.212.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
==============================================================================
Generating script.
========================== Starting Command Output ===========================
/usr/bin/bash --noprofile --norc /home/vsts/work/_temp/cdbbdb6f-d565-4658-a9db-477a3e230853.sh
Cloning into 'ci-info'...
Switched to a new branch 'patch-2'
branch 'patch-2' set up to track 'origin/patch-2'.

> ci-info@3.8.0 prepare
> husky install

husky - Git hooks installed

added 259 packages, and audited 260 packages in 12s

114 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
The name of the CI server is: Azure Pipelines
Is this a pull request?: true
Finishing: CmdLine
sibiraj-s commented 11 months ago

Published in v3.9.0