-
Notifications
You must be signed in to change notification settings - Fork 145
Add the ability to create custom plugin builds #3044
Conversation
The plugin build is not rendering the dashboard. Its unrelated to the changes here, but I'll bring it up here and separate it out to another issue if need be. This is only reproduced using the plugin build, not development. Could there be a feature flag issue?
Which is causing problems here:
|
@psealock Can you upload the resulting .zip file somewhere? Seems like maybe the PHP side of the feature flags isn't loading / prefetching some of the data. |
Sure. Shouldn't the task list logic not run at all if the onboarding flag is set to false for the plugin? |
Oh sorry, I misunderstood. When you said this was unrelated to the changes, did you mean this is happening on master with the normal build plugin command? I’ll take a look tomorrow. |
dc775b7
to
9e863c1
Compare
Yes, thanks for addressing. I'll have another look at this one. |
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.
ZIP_FILE="woocommerce-admin-$2.zip"; | ||
fi | ||
shift | ||
done |
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.
Ah ok, so the slug can be anything, ie onboarding-test-wpcom
, but isn't required. Thats nice 👍
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.
Looks like the error reported here, #3056
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.
That was indeed the same error @psealock. I've rebased this, and made sure to test the zip with that option cleared out. Should be fixed now.
9e863c1
to
7e82354
Compare
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.
Code looks good (with one optional nitpick/question/comment) and tests well.
Tested on a Jurrasic test site, uploading the zips.
bin/generate-feature-config.php
Outdated
@@ -18,6 +18,14 @@ | |||
$config_json = file_get_contents( 'config/' . $phase . '.json' ); | |||
$config = json_decode( $config_json ); | |||
|
|||
if ( ! empty( $_SERVER['WC_ADMIN_ADDITIONAL_FEATURES'] ) ) { | |||
$additional_features = json_decode( $_SERVER['WC_ADMIN_ADDITIONAL_FEATURES'], true ); |
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.
This seems to work fine, but would $_ENV
or getenv()
be better than $_SERVER
here? ($_SERVER
just makes me think we're in an HTTP request and not a cli script)
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.
Updated to $_ENV
. Agreed this makes more sense since they are environment variables.
Part of #3038.
This PR adds the ability to generate custom plugin builds. We would like to start testing onboarding with others inside of Automattic, including non-developers. Being able to generate and provide a zip so testers don't need to build development will increase testing adoption.
I wanted to make this more general purpose, so the
build:release
command now accepts some optional arguments:--slug
and--features
. Base feature flags are pulled fromconfig/plugin.json
and your additional changes are overlaid on top. When the build is complete, awoocommerce-admin-$slug.zip
file will be generated.For example, to create a
woocommerce-admin-onboarding.zip
build by enabling onboarding in addition to the feature flags defined inconfig/plugin.json
, the command would be:npm run build:release -- --slug onboarding --features '{"onboarding":true}'
.This PR also sets the default calypso environment to
wpcalypso
for now, so that Calypso changes can also easily be tested without needing to build a local copy of Calypso: Automattic/wp-calypso#36790Detailed test instructions:
npm run build:release
command and verify things look as they should.npm run build:release -- --slug onboarding --features '{"onboarding":true}'
. Uploading the resulting zip on another test site (such as wpsandbox) should allow you to test onboarding. You may need to reset the wizard underOrders > Help > Setup Wizard
.