-
Notifications
You must be signed in to change notification settings - Fork 248
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
Detect changed workspaces & trigger CI #13
Conversation
Signed-off-by: Philipp Hugenroth <philipph@spotify.com> Co-authored-by: Vincenzo Scamporlino <vinzscam@users.noreply.github.com>
Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
5ad73bc
to
44c0dac
Compare
Co-authored-by: Philipp Hugenroth <philipph@spotify.com> Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
44c0dac
to
78e60a1
Compare
Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
68062ac
to
a3c3b83
Compare
Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
a3c3b83
to
f7ec1b7
Compare
Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
8195ffb
to
f47bfc0
Compare
Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
Run into prettier warnings with the default template, which lead to failing CI. That's not great & should be fixed! |
Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
Co-authored-by: Philipp Hugenroth <philipph@spotify.com> Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
Co-authored-by: Philipp Hugenroth <philipph@spotify.com> Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
Co-authored-by: Philipp Hugenroth <philipph@spotify.com> Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
Co-authored-by: Philipp Hugenroth <philipph@spotify.com> Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
18b93d6
to
e50f7b9
Compare
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
Here is the PR fixing the prettier issue I ran into earlier: backstage/backstage#23139 |
Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
The current example workspaces will be removed after review & should not be considered in the review. It just helps to showcase the current workflows & their capabilities. |
Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
54fe1f0
to
6e85828
Compare
package.json
Outdated
@@ -4,11 +4,15 @@ | |||
"version": "0.0.0", | |||
"repository": "git@github.com:backstage/community-plugins.git", | |||
"scripts": { | |||
"create-workspace": "node ./scripts/create/create.js" | |||
"create-workspace": "node ./scripts/create/create.js", | |||
"detect-workspace": "node ./scripts/ci/changes.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this one worth having here? Not really for end users to run. Might as well just call this command directly inside the CI script I think.
May also make sense to name these create/create-workspace.js
and ci/list-workspaces-with-changes.js
or so, helps find the right one in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah - good point - could be removed
scripts/ci/changes.js
Outdated
|
||
changedFiles.forEach((name) => { | ||
// First match with prefix = "workspaces/" & suffix = "/" | ||
const match = name.match("(?<=workspaces/)([^/]+)(?=/)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const match = name.match("(?<=workspaces/)([^/]+)(?=/)"); | |
const match = name.match("workspaces/([^/]+)/"); |
No need for the fancy post-and prefix matching right? :)
Also, i don't know if these are relative or absolute, but it would feel better if we could anchor it with ^
at the start so it doesn't spuriously match on these words later in the path somewhere. Or string.split
or whatnot
And speaking of that ... does this work on windows too? Will we have windows based tests later? Does the GitUtils always emit forward slashes or not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And speaking of that ... does this work on windows too? Will we have windows based tests later? Does the GitUtils always emit forward slashes or not
it shouldn't matter so much as this script is only meant to be run by the CI on an ubuntu runner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adjusted the anchor.
The path name is comming from GitUtils
in @backstage/cli-node
, which is basically just running git diff
. If I'm not mistaking git
always handles paths the UNIX way (e.g. when writing a .gitignore
you also have to use forward slashes) - and that should also be the case here with giving back the diff
. I could not find a documentation proving my point though (only found example outputs of people running it on windows). My suggestion is to keep this in mind - should be rather easy to fix.
As Vincenzo said we also probably won't need to detect the affected workspaces on windows machines. Though want to clarify that we probably want to run tests & CI for workspaces on windows in the future.
Co-authored-by: Fredrik Adelöw <freben@gmail.com> Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
6df38ee
to
fe105a8
Compare
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've taken a look at each of the CI scripts and they LGTM. But, consider this approval more of an endorsement of the overall CI flow so far. It looks like a great starting point, thanks!
I feel it'll probably be easier to iterate and debug edge cases once we have this initial CI flow landed.
Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
Closes #6
To be reviewed:
At this point it is the goal to get a basic CI up & running. Therefor the only files to be reviewed are the
ci.yml
workflow & thescripts/ci
folder.All other +150 files in workspaces will be removed once approved. They are only needed to actually see the workflows running & give a minimal example.
Current idea of the flow:
yarn.lock
file of the workspace & verify the changeset only mentions non-private packages in the workspace (e.g. no release for the example app)Questions:
TODO: