Skip to content

Conversation

@CaseyHillers
Copy link
Contributor

Description

Ports logic from flutter/cocoon agent to be directly included in the test runner script.

If service-account-file and task-key are passed on devicelab runs, it will attempt to upload the results to Cocoon.

This is needed for migrating the devicelab to LUCI as we are deprecating the Cocoon agent.

Related Issues

#66191 - Add support to devicelab test runner to upload results to Cocoon

Tests

I added the following tests:

Cocoon checks for validating the sent request and reading the service account file correctly.

Runner invokes cocoon upload when a service account file flag is passed.

Checklist

Before you create this PR, confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I signed the [CLA].
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read [Handling breaking changes].

  • No, no existing tests failed, so this is not a breaking change.
  • Yes, this is a breaking change. If not, delete the remainder of this section.

@flutter-dashboard flutter-dashboard bot added the c: contributor-productivity Team-specific productivity, code health, technical debt. label Oct 16, 2020
@google-cla google-cla bot added the cla: yes label Oct 16, 2020
/// Key for the task to upload to in Flutter infrastructure.
///
/// Only used if [serviceAccountFile] is passed.
String taskKey;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we have all the resources needed to compute the task key here, but then we make it harder to change it on the backend.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good point where are not going to have server generated keys anymore. As the task entry will be generated until cocoon gets the first notification from luci.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to only use the commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can pass the commit instead, and update cocoon to take the commit sha + task name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we assume git will be on the host running this test? If so, we could just pull this from git

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I started to work on the backend change for this, and realized we're going to need to send the branch as well.

Do you know if recipes knows about the branch?

Copy link
Contributor

Choose a reason for hiding this comment

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

They now about the release ref dev, stable, etc. But I assume getting the branch is possible using git.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I got a bit further in the backend, and we can scratch pulling the branch here. I removed the git commit sha flag, and pull it in the cocoon client via git.

If we switch to building these tests as a binary for the bot, we'll need to pass the commit sha as a flag.

Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

Nice! LGTM

Also: #68240

/// Key for the task to upload to in Flutter infrastructure.
///
/// Only used if [serviceAccountFile] is passed.
String taskKey;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good point where are not going to have server generated keys anymore. As the task entry will be generated until cocoon gets the first notification from luci.

);
}

/// Call [fn] retrying so long as [retryIf] return `true` for the exception
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use the retry package here instead of reimplementing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had this discussion on discord, and consensus is for something trivial like this to just implement it. It prevents future headaches.

Initially, I did try it and kept running into headaches with getting it to not have pub issues.

/// Key for the task to upload to in Flutter infrastructure.
///
/// Only used if [serviceAccountFile] is passed.
String taskKey;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to only use the commit?

Copy link
Contributor

@godofredoc godofredoc left a comment

Choose a reason for hiding this comment

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

Thanks for implementing this functionality.

@fluttergithubbot fluttergithubbot merged commit 1c35091 into flutter:master Oct 19, 2020
@CaseyHillers CaseyHillers mentioned this pull request Oct 20, 2020
10 tasks
@CaseyHillers CaseyHillers deleted the cocoon_client branch August 16, 2021 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: contributor-productivity Team-specific productivity, code health, technical debt.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants