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

jumpstart / git-caching #15900

Merged

Conversation

allisonkarlitskaya
Copy link
Member

@allisonkarlitskaya allisonkarlitskaya commented Jun 7, 2021

The summary:

  • minor changes to the copyright scanning script to avoid a mess on stderr
  • add a new git-utils.sh which contains a common implementation of the logic for maintaining and using a cache of a git repository of a given name relative to GITHUB_BASE, with utilities for checking it out to various different places in the cockpit tree
  • use that from tools/node-modules
  • use that from tools/make-bots
  • use that from test/common/pixel-tests
  • use that from a new script tools/jumpstart
  • use that last one from test/make_dist.py
  • only commit dist/ and package-lock,json to cockpit-dist

@allisonkarlitskaya allisonkarlitskaya force-pushed the make-bots-caching branch 3 times, most recently from 10125db to 5b0a27d Compare June 7, 2021 13:21
@allisonkarlitskaya allisonkarlitskaya added the no-test For doc/workflow changes, or experiments which don't need a full CI run, label Jun 7, 2021
@allisonkarlitskaya allisonkarlitskaya marked this pull request as ready for review June 7, 2021 13:41
Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

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

Thanks! Aside from the naming question (hardest of all!) my biggest worry is about the split. The rest is small local issues which should hopefully be easy to fix.

tools/git-utils.sh Outdated Show resolved Hide resolved
tools/git-utils.sh Show resolved Hide resolved
tools/node-modules Outdated Show resolved Hide resolved
tools/git-utils.sh Show resolved Hide resolved
tools/git-utils.sh Outdated Show resolved Hide resolved
tools/git-utils.sh Outdated Show resolved Hide resolved
tools/git-utils.sh Show resolved Hide resolved
tools/make-bots Show resolved Hide resolved
tools/jumpstart Outdated Show resolved Hide resolved
tools/jumpstart Outdated Show resolved Hide resolved
test/common/pixel-tests Outdated Show resolved Hide resolved
test/common/pixel-tests Outdated Show resolved Hide resolved
test/common/pixel-tests Outdated Show resolved Hide resolved
@allisonkarlitskaya allisonkarlitskaya force-pushed the make-bots-caching branch 2 times, most recently from d637e2b to 557af25 Compare June 8, 2021 08:18
@allisonkarlitskaya
Copy link
Member Author

the pixel tests commit was a disaster, so I've dropped it.

@martinpitt martinpitt added the .github-changes Set by a reviewer just before landing to acknowledge that a PR changes github workflows label Jun 8, 2021
@martinpitt
Copy link
Member

martinpitt commented Jun 8, 2021

packit fails with

tools/jumpstart: line 29: NODE_ENV: unbound variable

I'm ack'ing github-changes here, mostly want to see it being removed by the next force-push again 😁

@allisonkarlitskaya
Copy link
Member Author

allisonkarlitskaya commented Jun 8, 2021

I'm ack'ing github-changes here, mostly want to see it being removed by the next force-push again grin

Uh. Oops?

The deconstruction of the context object in the script is bugged. There is no context.number, but rather context.issue.number. I'm gonna get rid of the entire thing and replace it with direct references in the call. I start to find this deconstruction assignment syntax to be a bit troublesome... That's for another PR, though.

@martinpitt martinpitt added .github-changes Set by a reviewer just before landing to acknowledge that a PR changes github workflows and removed .github-changes Set by a reviewer just before landing to acknowledge that a PR changes github workflows labels Jun 8, 2021
Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

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

The fine-grained stuff is fine now, thanks for the fixes! Now we just need to talk about the outstanding issue above (not having two scripts which do almost the same thing, and defining its purpose). "script that does something" is not good enough, sorry 😁

@github-actions github-actions bot removed the .github-changes Set by a reviewer just before landing to acknowledge that a PR changes github workflows label Jun 8, 2021
@allisonkarlitskaya
Copy link
Member Author

So there are two separate scripts here, that actually don't have a lot to do with each other, in my opinion.

One script takes a fresh repository and pre-seeds it with some nice stuff to get you up and running as fast as possible. It's very logically called "jumpstart", because that's what it does.

The other script builds a tarball from a repository, using the best means available (possibly including #1, but not always) and tells you the path to the tarball. It's very logically called "make dist", because that's what it does.

Let's chat tomorrow :)

@martinpitt
Copy link
Member

How about tools/webpack-jumpstart? That aligns with tools/webpack-{make,watch} and at least says what it jumpstarts. Maybe that's the sort of good compromise that makes us about equally (but hopefully not too much) grumpy 😁

@allisonkarlitskaya
Copy link
Member Author

I'm fine with the name, if it needs to be that way (although it pushes against my plans to also add a bots checkout).

The only real issue remaining here is what to do with make_dist.py. You mentioned that packit is using that (and some quick grepping also turns up livetest.yml and make-debs/make-srpm), so I'm afraid we can't just merge it into image-prepare. I'm happy to port it to shell if you think that's nicer, and maybe move it to tools/. I'm also happy to move --wait to the jumpstart script...

Thoughts?

@allisonkarlitskaya
Copy link
Member Author

As discussed, the latest changes:

  • script is now called webpack-jumpstart
  • drop the publish workflow changes. will proposed those in a separate PR along with a change to use the newly-added pkg/build (and no container) to drive the "build" side.

@martinpitt martinpitt added the blocked Don't land until something else happens first (see task list) label Jun 9, 2021
@martinpitt
Copy link
Member

Adding blocked, as @allisonkarlitskaya told me on IRC to hold off on this. Also, this needs integration test runs.

Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

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

Thanks! Found a few more little issues, but nothing important -- ok for me to land as-is once you are happy. I'll trigger a few tests over night to get some results.

tools/git-utils.sh Show resolved Hide resolved
test/make_dist.py Show resolved Hide resolved
@@ -0,0 +1,50 @@
#!/bin/sh

# Download pre-built webpack for current git SHA from GitHub
Copy link
Member

Choose a reason for hiding this comment

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

I think this should say dist/. As you noticed today, there's dist/guide which isn't a webpack, and the corresponding workflow is also called build-dist, not build-webpack. I wouldn't mind to rename the script accordingly as well (dist-jumpstart, or download-dist), but I feel for this PR I've already used up my quota of name bikeshedding; I can certainly live with the current one 😁

@martinpitt martinpitt requested review from martinpitt and removed request for martinpitt June 9, 2021 20:14
@martinpitt martinpitt dismissed their stale review June 9, 2021 20:14

previous issues got solved

@martinpitt martinpitt removed the no-test For doc/workflow changes, or experiments which don't need a full CI run, label Jun 9, 2021
@martinpitt
Copy link
Member

The other test failures are known flakes, but this one looks relevant:

fatal: Not a valid object name 380ae06319b3e0ebeba0b46e8117e137e3f66315:.package.json
cmp: EOF on - which is empty

*** node_modules 380ae06319b3e0ebeba0b46e8117e137e3f66315 doesn't match our package.json
*** refusing to automatically check out node_modules

@allisonkarlitskaya allisonkarlitskaya removed the blocked Don't land until something else happens first (see task list) label Jun 10, 2021
@allisonkarlitskaya
Copy link
Member Author

The other test failures are known flakes, but this one looks relevant:

I have absolutely no idea why that would be the case, particularly considering the build, running in the exact same tasks container, is working for all of the other images.

Maybe some weird race? Ugh.

`make dist` has been flooded with warnings about binary files (mostly
fonts) matching some unspecified grep pattern.  Turns out that was
coming from our copyright scanning attempts.

Just ignore those files.
Create a new file called git-utils.sh which can be used as a basis for
our growing number of utilities which download various subdirectories
from git.

This is mostly a port of functionality from tools/node-modules, with
changes and some minor additions.
Port tools/make-bots to git-utils.sh.

The main benefit of this change is that we handle the caching in the
same way as the other repositories now.  Previously, we'd only use a
cache directory if it already existed, and we'd never try to keep it up
to date.

The improved caching also presents an interesting opportunity: if the
OFFLINE environment variable is set to a non-zero value and the local
cache is available, it becomes possible to checkout bots/ without
network access.
Make use of the new git-utils.sh functions to write a small "jumpstart"
helper script which can be used to get a node_modules/ and dist/ of a
freshly-checked-out cockpit tree.

Most of this functionality comes from test/make_dist.py, which is now
rewritten to use the new script.  The main difference is that we only
unpack dist/.

Before unpacking, we add an additional check that package-lock.json from
the dist tree is equal to the one we have locally.  This has two
benefits:

 - to ensure that we don't have a mismatched cache for the local tree

 - forcing the fetch of package-lock.json (and node_modules/ generally)
   to occur before unpacking dist/ is a way of ensuring the the
   timestamps will be correct: dist/ will be newer.
@allisonkarlitskaya
Copy link
Member Author

allisonkarlitskaya commented Jun 10, 2021

The other test failures are known flakes, but [this one looks relevant](https://logs.cockpit-

Pretty sure I figured it out, and it was cool: an interrupted (or concurrently running) git fetch can leave us in a state where we have the commit object present in the repository, but not the tree and file objects that it points to.

Performing a simple lookup with rev-parse, as we do to avoid fetching, would return "true" in that case, but we wouldn't actually be able to access the files.

I'm pretty sure one of our runners ended up with its cache corrupted in exactly this way, which is why this test kept failing, but only for some attempts.

I moved the check over to a full connectivity-checking fsck call instead. That should catch this issue. In that case we'll redo the fetch.

Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

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

Thanks! Green, and the misleading comment above is not that important. I'm sure that we'll touch this stuff more 😁

@martinpitt martinpitt merged commit 313d9a8 into cockpit-project:master Jun 11, 2021
@allisonkarlitskaya allisonkarlitskaya deleted the make-bots-caching branch June 28, 2021 08:38
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