use snapshots when initiating github sync #2273
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Validation Steps
You'll need these envs:
GITHUB_APP_ID
GITHUB_APP_NAME
GITHUB_APP_CLIENT_ID
GITHUB_APP_CLIENT_SECRET
GITHUB_CERT
You also need a github repo. I would advise that you create an empty repo in your account with just the
README
. I have one just like that for testing these github work: https://github.com/midigofrank/openfnIf you're testing this locally, you'll need a tunnelling tool. I always use https://ngrok.com/docs/getting-started/ .
Assuming you're using
ngrok
, run the command below and copy the URL generated.Replace call to
LightningWeb.Endpoint.url()
using that URL in this line https://github.com/OpenFn/lightning/blob/main/lib/lightning/version_control/version_control.ex#L548Please remember to undo this change once you're done
How to validate
The aim is to initiate a sync and modify our workflow before the github action runs. We can achieve this by cancelling/stopping the github action and then later retry it.
Sync to Github
tab under project settings page.github/workflows/openfn-pull.yml
and cancel it.action
completes, we expect that theyaml
committed in your github repo NOT to contain the changes you did in Step 6. It should have the original workflow and job namesNotes for the reviewer
priv/github/pull.yaml
to handle thesnapshot input
sentstate.json
andproject.yaml
with snapshots. It expects the user to hit the endpoint with?snapshots[]=uuid1&snapshots[]=uuid2&snapshots[]=uuid3
.The logic for getting this data in the contexts has been modified to accept
nil
orlist
cli-pull-action
to use the snapshots. Here is the PR: Add flag for snapshots incase they're provided cli-pull-action#2.Notice that it adds the
--snapshots
flag only if thesnapshots
are provided.Also notice that
priv/github/pull.yaml
has been modified to usemidigofrank/cli-pull-action
. PLEASE REMEMBER TO REMOVE IT ONCE THE PR IN THE ORIGINAL REPO HAS BEEN MERGED AND A RELEASE PUBLISHED. The only reason I've used my fork is because I didn't want to litter the original repo with test releasespull
command to accept the--snapshots
option: CLI: add an option topull
that targets given snapshots kit#729Related issue
Fixes #1827
Review checklist
:owner
,:admin
,:editor
,:viewer
) have been implemented and tested