Skip to content

Fix support for setting environment variables in pipeline stages#356

Merged
nikita-tkachenko-datadog merged 1 commit into
masterfrom
nikita-tkachenko/build-data-values-propagation
Aug 28, 2023
Merged

Fix support for setting environment variables in pipeline stages#356
nikita-tkachenko-datadog merged 1 commit into
masterfrom
nikita-tkachenko/build-data-values-propagation

Conversation

@nikita-tkachenko-datadog

@nikita-tkachenko-datadog nikita-tkachenko-datadog commented Aug 24, 2023

Copy link
Copy Markdown
Collaborator

Requirements for Contributing to this repository

  • Fill out the template below. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • The pull request must only fix one issue at the time.
  • The pull request must update the test suite to demonstrate the changed functionality.
  • After you create the pull request, all status checks must be pass before a maintainer reviews your contribution. For more details, please see CONTRIBUTING.

What does this PR do?

Update BuildData creation logic: when a new instance is created, a check is made to see whether the associated run already refers to another instance that was created and updated during previous pipeline stages.
If there is a previously created instance, it is used to populate Git values in the new instance, in case they are missing.

For instance, if there are environment variables that are set inside a pipeline stage (e.g. Git branch and repo URL that are set during SCM checkout), these variables will only be available during that stage: later stages will not be able to use them.
The fallback mechanism ensures that these variables are propagated whenever a new BuildData instance is created at some later point.

This fixes https://datadoghq.atlassian.net/browse/AGENT-10162

Description of the Change

Alternate Designs

Possible Drawbacks

Verification Process

Verified manually using a dockerized Jenkins instance.

Additional Notes

Release Notes

Review checklist (to be filled by reviewers)

  • Feature or bug fix MUST have appropriate tests (unit, integration, etc...)
  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have one changelog/ label attached. If applicable it should have the backward-incompatible label attached.
  • PR should not have do-not-merge/ label attached.
  • If Applicable, issue must have kind/ and severity/ labels attached at least.

@nikita-tkachenko-datadog nikita-tkachenko-datadog added the changelog/Fixed Fixed features results into a bug fix version bump label Aug 24, 2023
@nikita-tkachenko-datadog nikita-tkachenko-datadog changed the title When creating a new BuildData instance, use BuildData populate during previous pipeline stages When creating a new BuildData instance, use BuildData populated during previous pipeline stages Aug 24, 2023
…ulated during previous pipeline stages as fallback
@nikita-tkachenko-datadog
nikita-tkachenko-datadog force-pushed the nikita-tkachenko/build-data-values-propagation branch from baa9117 to 2ac929e Compare August 24, 2023 11:24

@sarah-witt sarah-witt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@nikita-tkachenko-datadog
nikita-tkachenko-datadog merged commit 55103b9 into master Aug 28, 2023
@nikita-tkachenko-datadog
nikita-tkachenko-datadog deleted the nikita-tkachenko/build-data-values-propagation branch August 28, 2023 08:42
@sarah-witt sarah-witt changed the title When creating a new BuildData instance, use BuildData populated during previous pipeline stages Fix support for environment variables in pipeline stages Oct 4, 2023
@sarah-witt sarah-witt changed the title Fix support for environment variables in pipeline stages Fix support for setting environment variables in pipeline stages Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/Fixed Fixed features results into a bug fix version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants