Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

[turborepo] turbo-ignore doesn't provide a way to specify a commit to compare #5080

Closed
denexapp opened this issue May 23, 2023 · 4 comments
Closed
Labels

Comments

@denexapp
Copy link

Which project is this feature idea for?

Turborepo

Describe the feature you'd like to request

Backstory

This is a continuation of our conversation with @anthonyshew on the turbo discord server: https://discord.com/channels/818588653005176832/1108910806269169785

It has led to some improvements in the docs, namely #5039 and #5041, which has resolved some inconsistency between the docs and the actual behaviour, but it doesn't solve the problem.

The problem

Turborepo docs have a page called Skipping tasks in CI. The docs tell about a simple CLI tool, turbo-ignore, that uses turbo under the hood. This tool returns status code 1 if a workspace have changes and 0 otherwise. The docs page suggests that you should use it in CI.

In a CI pipeline that starts when a new commit gets pushed, you want to compare this commit with a commit of the latest sucessful deployment. The docs page mentioned before implies that you can do that by showing the following command as the example of a command that gets generated under the hood, when turbo-ignore interacts with turbo. Note the specified commit sha:

npx turbo run build --filter=@example/web...3c8387ffd98b751305fe3f0284befdd00cbd4610 --dry=json

On Vercel, it happens automatically - turbo-ignore adapts if it sees Vercel specific environment variables. On the other hand, in your own CI you're supposed to provide it by yourself. The problem is that there's no way to provide it, which makes turbo-ignore basically useless outside of Vercel.

Describe the solution you'd like

I don't have an exact solution, but there should be a way to provide commit sha to compare to. One idea might be to introduce a new flag that accepts it.

Describe alternatives you've considered

I tried using the --fallback flag, as the docs page suggested to before the mentioned PR's were merged, and it didn't worked.

I ended up copying parts of turbo-ignore into my own CI scripts, so I manually call turbo with the --dry flag and look for the packages field in the returned JSON.

@denexapp denexapp added needs: triage New issues get this label. Remove it after triage story labels May 23, 2023
@mehulkar mehulkar added pkg: turbo-ignore packages/turbo-ignore and removed needs: triage New issues get this label. Remove it after triage labels May 28, 2023
@mehulkar
Copy link
Contributor

mehulkar commented May 28, 2023

Reading the code, it looks like you could spoof this by setting some environment variables, but that isn't ideal. cc @tknickman for suggestions. It seems like a relatively easy script to duplicate in userland, if we aren't intending on turbo-ignore to be usable outside Vercel. If @tknickman is ok with adding a more general purpose feature, I'm sure we'd be open to a pull request!

@mehulkar mehulkar added the needs: team input Filter for core team meetings label May 28, 2023
@tknickman
Copy link
Member

Yea we can certainly extend this to provide a custom comparison

@tknickman tknickman removed the needs: team input Filter for core team meetings label May 30, 2023
@denexapp
Copy link
Author

Do you mind if I make a PR, or do you plan to implement it internally?

@tknickman
Copy link
Member

You are more than welcome to make a PR!

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants