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

Users/dakale/use ruby #10083

Merged
merged 13 commits into from
Apr 12, 2019
Merged

Users/dakale/use ruby #10083

merged 13 commits into from
Apr 12, 2019

Conversation

dakale
Copy link
Contributor

@dakale dakale commented Apr 10, 2019

Adds task for use: ruby

Task has two inputs per design: version, architecture. Both optional.

Version input has no behavior change from existing Use Ruby Version task, will fail if tool is not found in cache

(@damccorm since I cant add reviewer without write access)

@damccorm damccorm self-requested a review April 10, 2019 19:24
Tasks/UseRubyV1/useruby.ts Outdated Show resolved Hide resolved
export async function installRubyVersion(parameters: TaskParameters): Promise<void> {
const toolName: string = "Ruby";
const installDir: string | null = tool.findLocalTool(toolName, parameters.version, parameters.architecture);
if (!installDir) {

Choose a reason for hiding this comment

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

This doesn't make sense to me - why are we throwing if the tool isn't found locally? Shouldn't we download if its not found?

Choose a reason for hiding this comment

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

And cache it once we download it.

Choose a reason for hiding this comment

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

I guess this is what the existing task is doing, it feels like we should be able to do better than that though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Double checking with @vtbassmatt

I think the idea was to preserve behavior for now and extend later

Choose a reason for hiding this comment

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

Ok - if we do decide to download it looks like the dist is pretty well structured - https://cache.ruby-lang.org/pub/ruby/

Can probably basically just do the same thing we do in the UseNode task

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I can tell those are not prebuilt binaries and I doubt we can afford the time to build ruby on demand. Ill dig in a little more, but I believe lack of simple multiplat binary distributions is part of why the existing task doesnt have this functionality

Choose a reason for hiding this comment

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

Oh yeah, you're right 😕

I still think its weird that we download other tools when they're not present, but not Ruby. It looks like the plan is to do the same with Python though.

With that said, I don't see a good way around this so I guess I'm ok with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now that this is "done" Ill check with Matt on timelines. I think the on-demand install is a nice-to-have so we may choose to go for it, and see if its viable to get done within the timeline. I agree with you that being consistent would be ideal, and as far as I'm aware there's no licensing issues or anything blocking this.

I would probably say lets go ahead and get this merged if it looks correct, even if we end up immediately revisiting and extending it

Choose a reason for hiding this comment

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

Agreed

Copy link
Member

Choose a reason for hiding this comment

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

In an ideal world, we'd always download any version the customer asked for. In practice that's not always been easy/possible, so we've fallen back to just the tools cache. @dakale is right that we need to at least match parity, making improvements where possible but not blocking on them.

Tasks/UseRubyV1/installer.ts Outdated Show resolved Hide resolved
Tasks/UseRubyV1/package.json Outdated Show resolved Hide resolved
Tasks/UseRubyV1/installer.ts Outdated Show resolved Hide resolved
Tasks/UseRubyV1/installer.ts Outdated Show resolved Hide resolved
@@ -140,6 +140,7 @@
"UseDotNetV2",
"UseNodeV1",
"UsePythonVersionV0",
"UseRubyV1",

Choose a reason for hiding this comment

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

We should probably add this to codeowners as well: https://github.com/Microsoft/azure-pipelines-tasks/blob/master/.github/CODEOWNERS

I don't think it will work with you since you're not a maintainer, you can probably add bryan and me though. Alternately you can request to become a maintainer of the vsts-dt-admin group, Bryan would approve that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ill add myself as owner for now to catch any basic issues, then reassign to the proper ecosystem owner once they even are aware of its existence / are familiar with the changes

Choose a reason for hiding this comment

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

That's fine - my only concern is will CodeOwners work even though you're not a maintainer? (Genuinely not sure)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Im not sure. Are you aware of any automation that uses this information? I just assumed it was informational, and would serve as a way to route issues to me. It would be surprising if something tried to write to the repo on my behalf based on that info, since I could just put any name there

Does @stephenmichaelf know?

Choose a reason for hiding this comment

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

It doesn't write to a repo, but it does make the codeowner a required reviewer. For example, in #9716, Ross was added as a reviewer automatically since he's a codeowner.

https://github.blog/2017-07-06-introducing-code-owners/

Choose a reason for hiding this comment

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

I can't find any docs calling out that this only works for maintainers, I think we can probably assume it works for everyone. Worst case it doesn't and we just change it.

Tasks/UseRubyV1/package.json Outdated Show resolved Hide resolved
Remove Strings/
Use task.getPlatform instead of local variation
Add package.json to Tests/
Always set task.setResourcePath even if no version
@dakale
Copy link
Contributor Author

dakale commented Apr 11, 2019

Working on build failures. Will update

David Kale added 3 commits April 11, 2019 14:59
One build was timing out with 1000ms with no other apparent failure mode
Copy link

@damccorm damccorm left a comment

Choose a reason for hiding this comment

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

Left a couple comments, but overall this seems good.

assert(tr.stdout.includes('##vso[task.prependpath]' + '/Ruby/2.4.4/bin'), 'ruby tool location was not added to PATH as expected');
});

it('sets PATH correctly on Windows', function () {

Choose a reason for hiding this comment

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

Could you add a test to verify proxy behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, ive added a test in 6410e52

David Kale added 2 commits April 12, 2019 11:44
Also add preview: true to task.json
@damccorm
Copy link

Looks like a random timeout caused macos to fail, maybe increase the timeout a little bit more?

@dakale
Copy link
Contributor Author

dakale commented Apr 12, 2019

Yea, it looks like the mock-test runner downloads a node10 on the first run: https://github.com/Microsoft/azure-pipelines-task-lib/blob/master/node/mock-test.ts#L160 I only skimmed this code but seems to download node based on the node specified in the task. The test says it is testing against node 6, so I would like to verify that it is actually doing that, or if its using node10 per the task.json. Not going to invest that time right now though

That makes sense as to why the first test is the one thats always failing. For now, I think the easiest workaround is just to increase the timeout as mentioned. We could potentially add a new MockTestRunner() in the before to prime the cache, but that before would need a long timeout too, so only minor gains in terms of keeping the tests cohesive. Although it could potentially boost perf if for some reason all other tests were going to timeout, we would be waiting less time for the N tests to reach the new timeout.

@dakale
Copy link
Contributor Author

dakale commented Apr 12, 2019

For clarity, from the failing logs:

> mocha /Users/vsts/agent/2.150.0/work/1/s/_build/Tasks/UseRubyV1/Tests/L0.js /Users/vsts/agent/2.150.0/work/1/s/_build/Tests/L0.js


  UseRubyVersion L0 Suite
Downloading file: https://nodejs.org/dist/v10.15.1/node-v10.15.1-darwin-x64.tar.gz

    1) finds version in cache in Linux

The test suite header is printed, then a line about downloading, then the result of the test. Its easy to
verify that any output generated by the test is printed before the test failure, assuming no weird async behavior

@damccorm
Copy link

Its definitely testing against node 10, I'll think more about this timeout issue though. Regardless, that shouldn't be the responsibility of this task, we should probably handle it earlier in the build.

@damccorm
Copy link

I think this is good to go, I'll go ahead and merge

@damccorm damccorm merged commit 93b96a2 into microsoft:master Apr 12, 2019
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.

3 participants