Skip to content

Jetpack CLI: check and update monorepo docker image automatically once a day#46460

Merged
kraftbj merged 3 commits intotrunkfrom
update/jetpack-cli-1
Jan 7, 2026
Merged

Jetpack CLI: check and update monorepo docker image automatically once a day#46460
kraftbj merged 3 commits intotrunkfrom
update/jetpack-cli-1

Conversation

@kraftbj
Copy link
Copy Markdown
Contributor

@kraftbj kraftbj commented Jan 6, 2026

Proposed changes:

  • Add automatic daily check for updated automattic/jetpack-monorepo:latest Docker image
  • Support FORCE_PULL=1 environment variable to force an immediate image update check
  • Cache the last check timestamp in tools/docker/data/.monorepo-image-check to avoid checking more than once per 24 hours

Other information:

  • Have you written new tests for your changes, if applicable? (N/A - shell script change)
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)? (N/A)

Jetpack product discussion

N/A - Internal tooling improvement

Does this pull request change what data or activity we track or use?

No

Testing instructions:

Test automatic daily check:

  1. Delete the cache file if it exists: rm tools/docker/data/.monorepo-image-check
  2. Run any jp command: jp --help
  3. Verify you see "Checking for latest monorepo image..." and it runs docker pull
  4. Run jp --help again immediately
  5. Verify it does NOT check for the image again (no pull message)
  6. Check the cache file was created: ls -la tools/docker/data/.monorepo-image-check

Test FORCE_PULL environment variable:

  1. Run: FORCE_PULL=1 jp install
  2. Verify you see "Forcing image update due to FORCE_PULL environment variable..." and it checks for updates
  3. Verify the command still executes properly after the check

Test 24-hour expiry:

  1. Create an old cache file: touch -t 202501010000 tools/docker/data/.monorepo-image-check
  2. Run: jp --version
  3. Verify it checks for the latest image again (cache is > 24 hours old)

Copilot AI review requested due to automatic review settings January 6, 2026 17:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 6, 2026

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@kraftbj kraftbj added the Enhancement Changes to an existing feature — removing, adding, or changing parts of it label Jan 6, 2026
Per code review feedback, use bash builtin [[ ]] syntax instead of
POSIX [ ] for all conditionals in new code. This is more robust and
follows bash scripting best practices.
@kraftbj
Copy link
Copy Markdown
Contributor Author

kraftbj commented Jan 6, 2026

Thanks for the review @anomiex!

✅ Updated all 6 instances to use [[ ]] instead of [ ] for bash conditionals.

Regarding $EPOCHSECONDS: I tested and found that while it works in modern bash (5.3+), it returns an empty string in macOS's default bash 3.2.57. Since this script uses #!/usr/bin/env bash which will use the system bash on macOS, I kept $(date +%s) for bash 3.2 compatibility.

Note: I know I just said this, but I'm letting the AI tooling still post this as part of testing these tools.

@kraftbj kraftbj requested a review from anomiex January 6, 2026 19:42
@kraftbj kraftbj added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Jan 6, 2026
anomiex
anomiex previously approved these changes Jan 6, 2026
Copy link
Copy Markdown
Contributor

@anomiex anomiex left a comment

Choose a reason for hiding this comment

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

Seems reasonable, seems to work. One optional suggestion inline, feel free to ignore.

Copilot AI review requested due to automatic review settings January 7, 2026 15:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.

@kraftbj kraftbj requested a review from anomiex January 7, 2026 15:44
Copy link
Copy Markdown
Contributor

@anomiex anomiex left a comment

Choose a reason for hiding this comment

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

LGTM. Might want to update the PR description to remove reference to the --latest-image flag, to avoid potential confusion later.

@kraftbj kraftbj merged commit 0a4c0fb into trunk Jan 7, 2026
119 of 121 checks passed
@kraftbj kraftbj deleted the update/jetpack-cli-1 branch January 7, 2026 18:01
@github-actions github-actions bot removed the [Status] Needs Review This PR is ready for review. label Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Docker Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants