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

fix: install nightly version #78

Merged
merged 7 commits into from
May 17, 2021

Conversation

dinhtungdu
Copy link
Contributor

@dinhtungdu dinhtungdu commented Sep 30, 2020

Currently, wpsnapshots can't install WP nightly because nightly version is available as zip file, while we only handle gz file for now. This PR fixes this issue by handling zip file for nightly version.

Verification

Create latest/nightly snapshot

(To make it clearer, please downgrade the test WP installation to one major version behind.)

  1. cd to a WP directory, create a snapshot with the flag --wp_version, passing latest or nightly to create snapshot with respective WP version.
wpsnaphosts create --wp_version=latest
  1. Check the meta.json file, see the version field set to the version in the step above.

Pull newly created snapshot.

  1. cd to the WP directory, pull the snapshot created in the step above.
  2. See the pull process successfully.
  3. Check the WP version to match with the version in the step above.

src/classes/Command/Pull.php Outdated Show resolved Hide resolved
src/classes/Command/Pull.php Outdated Show resolved Hide resolved
dinhtungdu and others added 2 commits September 30, 2020 21:04
Co-authored-by: Eugene Manuilov <eugene.manuilov@gmail.com>
Co-authored-by: Eugene Manuilov <eugene.manuilov@gmail.com>
@eugene-manuilov
Copy link
Collaborator

Although this PR looks good from the first glance, I think we should try to use ZipArchive first if it is available, and only then try using unzip.

https://www.php.net/manual/en/ziparchive.extractto.php

Copy link
Collaborator

@eugene-manuilov eugene-manuilov left a comment

Choose a reason for hiding this comment

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

Mostly LGTM, left the final comment.

src/classes/Command/Pull.php Outdated Show resolved Hide resolved
@dinhtungdu
Copy link
Contributor Author

@eugene-manuilov I moved the extract commands to a private method for better readability, can you please give this PR another review?

Copy link
Collaborator

@eugene-manuilov eugene-manuilov left a comment

Choose a reason for hiding this comment

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

Thanks, @dinhtungdu! LGTM.

@tlovett1
Copy link
Member

tlovett1 commented Oct 6, 2020

Is anyone actually requesting to use snapshots with the nightly WP version?

@dinhtungdu
Copy link
Contributor Author

@tlovett1 Yes, we're planning to run WPAcceptance tests against the latest and nightly version of WordPress for 10up's open source plugins.

@jeffpaul
Copy link
Member

jeffpaul commented Oct 7, 2020

Adding to @dinhtungdu's comment, we're doing this to try and proactively catch any conflicts between our plugins and core development before a core release happens and we have to react after-the-fact and with a negative user experience.

@jeffpaul
Copy link
Member

@tlovett1 is there anything else you need to unblock merge on this PR? We're aiming for a ClassifAI release this week and this WP Snapshots enhancement will help with our WP core+ClassifAI test coverage to give us a higher level of confidence in the release, so would be ideal to get this Snapshots PR resolved early this week... thanks!

@tlovett1
Copy link
Member

tlovett1 commented Dec 1, 2020

@eugene-manuilov how do I test this? I assume a snapshot would have nightly as the wp_version in meta.json? I'm wondering how that works with snapshot pushing because if you were running a nightly version and you pushed a snapshot, wouldn't it store the actual version number in meta e.g. 5.6beta2323 or whatever?

@dinhtungdu
Copy link
Contributor Author

@tlovett1 @eugene-manuilov to set nightly version, I create a snapshot locally first, then update the wp version in the meta.json file to nightly. After that I push the snapshot by id to AWS.

@eugene-manuilov
Copy link
Collaborator

@dinhtungdu can you update your pull request to make sure that the version for nightly snapshots is set correctly when we run the push command?

@tlovett1
Copy link
Member

Updating meta.json manually to me isn't an acceptable workflow for creating a snapshot. I think this needs to be rethought a bit. Ideally, WP Snapshots would allow you somehow to set the version as latest or nightly. Maybe this happens in the CLI as a prompt.

@tlovett1 tlovett1 modified the milestones: 2.1.0, 2.2.0 Jan 22, 2021
@dinhtungdu
Copy link
Contributor Author

dinhtungdu commented Jan 22, 2021

@eugene-manuilov @tlovett1 I'm sorry for the late reply. I will add a flag to push/create command to handle the latest/nightly version.

Edit: I added wp_version flag to override WP version in meta.json. It can be latest, nightly, or specific WP versions.

@tlovett1
Copy link
Member

tlovett1 commented May 3, 2021

Can you give me instructions on testing this?

@dinhtungdu
Copy link
Contributor Author

@tlovett1 I add the verification steps to the PR description.

@@ -49,6 +49,8 @@ protected function configure() {
$this->addOption( 'db_name', null, InputOption::VALUE_REQUIRED, 'Database name.' );
$this->addOption( 'db_user', null, InputOption::VALUE_REQUIRED, 'Database user.' );
$this->addOption( 'db_password', null, InputOption::VALUE_REQUIRED, 'Database password.' );

$this->addOption( 'wp_version', null, InputOption::VALUE_OPTIONAL, 'Override the WordPress version.' );
Copy link
Member

Choose a reason for hiding this comment

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

Why is this VALUE_OPTIONAL? You need to supply a WP version if you use this option

@tlovett1 tlovett1 merged commit 9ef233d into 10up:develop May 17, 2021
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.

4 participants