-
Notifications
You must be signed in to change notification settings - Fork 7
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
How to use files from plugin / blueprint repo in wp-cli blueprint step #99
Comments
@leewillis77 - a prime example of how to use Playground!
If one of the approaches above works, please let me know which. And if possible if I could include a link to importing demo content to this example use case from the docs, that would be excellent! |
Hi @flexseth; Thanks for the quick reply, but I don't think either of those examples really help. Human Made's package is for running a WordPress import, which isn't the case here, the data is plugin-specific, so it's not done via a WordPress import. Even in the Simple User Listing plugin example while the data is not included in the blueprint.json file it looks like it's pulled from an external URL. What I'm asking in this issue is the ability to have a way for a step (in this case a wp-cli step) to access a file in the SVN repo. I can't currently see how to do that? See the 'wp-cli' step here https://plugins.svn.wordpress.org/say-what/assets/blueprints/blueprint.json The wp-cli command needs to access a file to read the information from, but I can't work out how to point that at https://plugins.svn.wordpress.org/say-what/assets/blueprints/sample-replacements.csv |
Interesting. I'm able to click and download the file, so it should be publicly accessible? This may be a limitation of the Definitely a use case we are looking to get ironed out very soon, so I will be following here and also trying to work on an example myself. The only problem is I don't have anything on SVN, or really know how to use Subversion at all. :/ |
Maybe, since essentially wp-cli is expecting a "local" file, not a URL, so I'm not clear on how I can either a) fetch the file from a remote and then have the wp-cli step access it somehow or b) have the wp-cli step use a remote file directly. |
@leewillis77 My understanding on import was that it needs to be somewhere public with a CORS policy set. I couldn't tell you in the SVN repo has that or not, but in a github repo with the raw github url should be accessible via cli. |
@leewillis77 - try out the demo from @ryanwelcher's livestream
I'm working on the docs, if you're able to get a technique similar to this to work, or however you get this working, please link the blueprint you come up with! CORSCan totally be a "gotcha" @helgatheviking may be correct with the Cross-Origin headers. You can try adding a PHP headers with a {
"steps": [
{
"step": "runPHP",
"options": {
"code": "<?php echo $_SERVER['CONTENT_TYPE']; ?>",
"headers": {
"Content-type": "text/plain"
}
}
}
]
} |
@helgatheviking @flexseth Thanks both for the comments, but they're not really relevant to the issue at hand - probably I'm explaining things badly, apologies. This is not an |
How about with PHP?What if you create a PHP snippet that will achieve what you need, and pass that through the In this example, Adam refactors a PHP snippet as a call to a changes to
|
@leewillis77 here's what I would do: {
"steps": [
{
"step": "writeFile",
"path": "/wordpress/sample-replacements.csv",
"data": {
"resource": "url",
"url": "https://plugins.svn.wordpress.org/<YOUR PLUGIN>/assets/blueprints/sample-replacements.csv"
}
},
{
"step": "wp-cli",
"command": "wp say-what import /wordpress/sample-replacements.csv"
}
]
} Let me know if that's helpful. |
Hey @adamziel; That looks like exactly what I was asking. It won't work as-is since plugins.svn.wordpress.org doesn't set the appropriate CORS headers to allow the fetch to work. Is that something we could get changed do you think? I can confirm that it does work if you (for example) point it at a GitHub raw URL (thanks @helgatheviking!) |
cc @tellyworth @dd32 – should |
The |
We probably don't want plugins.svn being accessed, but the CDN in front of it at Alex requested systems input back in November, and there hasn't been an outcome on whether adding CORS is possible. Private systems request: https://make.wordpress.org/systems/?p=2330 |
I'm currently looking to implement a preview for one of our wp.org hosted plugins. In order to set up a meaningful demo we'd like to import some sample data using a wp-cli command. It looks like I can specify a wp-cli step, but I'm unsure what the execution context is of that command and what files it can access.
Ideally I'd be looking at providing this sort of structure in the SVN repo:
I tried referencing the file directly without any path information, as the example below, but that doesn't appear to work.
Is there a way to reference asset files in playground steps?
The text was updated successfully, but these errors were encountered: