Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix upgrade.yml workflow failure #353

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

lym953
Copy link
Contributor

@lym953 lym953 commented Jan 18, 2025

Motivation

The upgrade.yml workflow upgrades the version of dependencies. It has been failing for a long time (sample GitHub Action run)
because it requires min Node.js version of 16.0.0 but our Datadog CDK Construct requires 14.15.0, and as a result, the projen framework uses version 14.15.0 to run upgrade.yml. I didn't find a way to make upgrade.yml run a later Node.js version without updating the minNodeVersion field of our CDK Construct.

What does this PR do?

Fixes upgrade.yml workflow. Details:

  1. In package.json, change projen version from ^0.81.8 to ^0.91.6 (latest so far)
  2. In .projenrc.js, change minNodeVersion from 14.15.0 to 18.18.0, which is required by stylistic/eslint-plugin package (see GitHub Action log)
  3. Run npx projen

Testing Guidelines

Automated tests

Pass the existing unit tests and integration tests

Manual tests

Steps:

  1. Trigger upgrade.yml workflow on this branch
    Result:
  2. The workflow runs successfully, which means the dependency issue has been fixed
  3. However, PR published by the workflow fails the integration test check. It needs manual changes. I will fix it in a separate PR.

Additional Notes

This is a breaking change in that it changes the required minimum node version minNodeVersion from 14.15.0 to 18.18.0. Therefore I will first merge this PR into the branch yiming.luo/v2-2, which will include the commits to be published in a major version bump (from v2-1.22.0 to v2-2.0.0). I will push more breaking changes to this branch, then bump the major version.

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog

working-directory: ./
- name: Upload patch
if: steps.create_patch.outputs.patch_created
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v4.4.0

Choose a reason for hiding this comment

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

🟠 Code Vulnerability

Workflow depends on a GitHub actions pinned by tag (...read more)

When using a third party action, one needs to provide its GitHub path (owner/project) and can eventually pin it to a Git ref (a branch name, a Git tag, or a commit hash).

No pinned Git ref means the action uses the latest commit of the default branch each time it runs, eventually running newer versions of the code that were not audited by Datadog. Specifying a Git tag is better, but since they are not immutable, using a full length hash is recommended to make sure the action content is actually frozen to some reviewed state.

Be careful however, as even pinning an action by hash can be circumvented by attackers still. For instance, if an action relies on a Docker image which is itself not pinned to a digest, it becomes possible to alter its behaviour through the Docker image without actually changing its hash. You can learn more about this kind of attacks in Unpinnable Actions: How Malicious Code Can Sneak into Your GitHub Actions Workflows. Pinning actions by hash is still a good first line of defense against supply chain attacks.

Additionally, pinning by hash or tag means the action won’t benefit from newer version updates if any, including eventual security patches. Make sure to regularly check if newer versions for an action you use are available. For actions coming from a very trustworthy source, it can make sense to use a laxer pinning policy to benefit from updates as soon as possible.

View in Datadog  Leave us feedback  Documentation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is generated code.

@lym953 lym953 force-pushed the yiming.luo/fix-upgrade branch from bf61c0a to 5b3bd0b Compare January 18, 2025 00:15
@lym953 lym953 changed the title Fix upgrade.yml workflow fix: Fix upgrade.yml workflow failure Jan 18, 2025
@lym953 lym953 force-pushed the yiming.luo/fix-upgrade branch 7 times, most recently from 8b1eddb to 2d909f6 Compare January 21, 2025 21:13
@lym953 lym953 changed the base branch from main to yiming.luo/rm-node-16 January 21, 2025 21:15
@lym953 lym953 force-pushed the yiming.luo/rm-node-16 branch from 7e8ee6a to 1b80ba6 Compare January 21, 2025 21:27
@lym953 lym953 force-pushed the yiming.luo/fix-upgrade branch 17 times, most recently from 6bcd98c to 9ae3d9e Compare January 22, 2025 21:37
@lym953 lym953 changed the base branch from yiming.luo/rm-node-16 to yiming.luo/v2-2 January 22, 2025 21:38
@lym953 lym953 force-pushed the yiming.luo/fix-upgrade branch from 9ae3d9e to 8aec7a7 Compare January 22, 2025 21:53
@lym953 lym953 marked this pull request as ready for review January 22, 2025 21:59
@lym953 lym953 requested a review from a team as a code owner January 22, 2025 21:59
@lym953 lym953 requested a review from hannahqjiang January 22, 2025 21:59
@lym953 lym953 merged commit 0de8d3c into yiming.luo/v2-2 Jan 23, 2025
10 checks passed
@lym953 lym953 deleted the yiming.luo/fix-upgrade branch January 23, 2025 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants