VOLTTRON / volttron

VOLTTRON Distributed Control System Platform
https://volttron.readthedocs.io/
Other
458 stars 216 forks source link

Create Downstream Test with github actions process #2867

Closed craig8 closed 2 years ago

craig8 commented 2 years ago

Assuming a PR is done provide a mechanism to test a downstream agent using that develop + PR code.

bonicim commented 2 years ago

I have verified that we can trigger actions from one repo to another repo. Our use case is to that whenever a volttron-core creates a PR, that event will trigger a workflow on a core agent repo. We need this mechanism to support our CI and release process for Modular Volttron. In my research, I have found that Github Actions supports this mechanism and can implemented in Workflows. Therefore, we can use Github to support our CI and release process for Modular Volttron. Below is an example with links and screenshots of how this works:

Consider two repos, volttron and volttron-openadr-ven-1, in which volttron is the repo creating a 'repository_dispatch' event and volttron-openadr-ven-1 is the repo receiving the aforementioned event. Volttron is considered the 'sender' repo and volttron-openadr-ven-1 is considered the 'receiver' repo.

Now consider the following flow:

  1. Volttron creates a PR
  2. Volttron starts a workflow called 'Repository Dispatch' which creates an event to be picked up by volttron-openadr-ven-1
  3. Upon receiving such event, volttron-openadr-ven-1 will start a series of actions such as running tests

Implementation:

Sender workflow: https://github.com/bonicim/volttron/blob/docs/asyncio/.github/workflows/repo-dispatch.yml Receiver workflow: https://github.com/bonicim/volttron-openadr-ven-1/blob/main/.github/workflows/repo-dispatch-triggered.yaml

Screen Shot 2022-02-02 at 10 49 56 AM

Screen Shot 2022-02-02 at 10 50 28 AM

Notes:

Questions:

schandrika commented 2 years ago

This is good.

  1. Question- can it trigger more than 1 downstream test?
  2. Yes if the downstream test fails then the upstream should either me marked as failed with the correct reason, or at least get a notification so that the reviewer assigned to the PR can take a look at the failing test cases
craig8 commented 2 years ago

@schandrika I get notifications from all the failed actions... you can to :) From there I agree we can divide and fix....I don't think that just because a downstream project fails it should be marked as a failure I think it depends on the repository and whether we are looking at regressions or agent failures.

So lets think about that more.

craig8 commented 2 years ago

I added a secret for PAT. We can talk about permissions at todays work meeting.

bonicim commented 2 years ago

@schandrika, responses below.

This is good.

  1. Question- can it trigger more than 1 downstream test?

It can trigger any number of tests among any number of repos. The third-party action allows for triggers on multiple repos. And in each corresponding repo, we can write a Workflow than can respond to a dispatch event and run any number of tests within that repo.

  1. Yes if the downstream test fails then the upstream should either me marked as failed with the correct reason, or at least get a notification so that the reviewer assigned to the PR can take a look at the failing test cases

For this workflow to occur, we can design the downstream Workflow to trigger another dispatch to the original repo triggering the first dipatch.

bonicim commented 2 years ago

I added a secret for PAT. We can talk about permissions at todays work meeting.

@craig8 Clarification on the PAT. Is there a PAT in place for the new volttron-core repo? From the Team's message, I understand that there's now PAT's for volttron and volttron-openadr.

craig8 commented 2 years ago

volttron, volttron-core, and openadr-ven are available for the action PAT. Let me know if you need others. The PAT is at the project level and we can add/remove repositories that has it available.