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

wp-env with "core: null" installs WP 5.4.2, not the latest version (5.6.0) #27763

Closed
leoloso opened this issue Dec 16, 2020 · 12 comments
Closed
Assignees
Labels
[Tool] Env /packages/env [Type] Bug An existing feature does not function as intended

Comments

@leoloso
Copy link

leoloso commented Dec 16, 2020

Describe the bug
When installing wp-env with "core: null", the latest version of WordPress should be installed.

However that is not happening: WordPress 5.4.2 is being installed instead.

To reproduce
Steps to reproduce the behavior:

  1. Use this wp-env.json file:
{
    "core": null
}
  1. Run wp-env start
  2. Go to the admin and the WordPress about page, or check the information in the Docker container

Expected behavior
The latest version of WordPress should be installed (currently 5.6.0)

Screenshots
Screenshot 2020-12-16 at 11 13 32 PM

Desktop (please complete the following information):

  • OS: MacOS
@talldan talldan added [Tool] Env /packages/env Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended and removed Needs Testing Needs further testing to be confirmed. labels Dec 17, 2020
@talldan
Copy link
Contributor

talldan commented Dec 17, 2020

@leoloso When I tested it used whatever version of WordPress I had installed previously. For me that was 5.6, I'm guessing you had 5.4.2 installed previously using wp-env?

I'll label as a bug though this could probably be handled as a documentation update.

@leoloso
Copy link
Author

leoloso commented Dec 17, 2020

I possibly did have WP 5.4.2, tbh I don't know. However, I also created a new folder and run wp-env start there, and it also installed WP 5.4.2, and there was no previous history there.

If the history doesn't belong to the project but to wp-env, then how I can force it to truly install the latest version of WP? The documentation doesn't mention this.

Btw, I also set-up the config below:

{
    "core": "WordPress/WordPress#5.6.0"
}

But it fails, with this error:

✖ unable to parse OID - contains invalid characters
Error: unable to parse OID - contains invalid characters
    at downloadGitSource (/usr/local/lib/node_modules/@wordpress/env/lib/download-source.js:115:20)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async downloadSource (/usr/local/lib/node_modules/@wordpress/env/lib/download-source.js:35:3)
    at async /usr/local/lib/node_modules/@wordpress/env/lib/commands/start.js:79:5
    at async Promise.all (index 1)
    at async start (/usr/local/lib/node_modules/@wordpress/env/lib/commands/start.js:70:2)

(Is this an unrelated bug? Should I create another issue?)

@talldan
Copy link
Contributor

talldan commented Dec 17, 2020

It uses git refs after the hash, so for a tag this works (this is actually how I have mine set up):

{
    "core": "WordPress/WordPress#tags/5.6"
}

The list of tags is here:
https://github.com/WordPress/WordPress/tags

@leoloso
Copy link
Author

leoloso commented Dec 17, 2020

Ok, thanks. I think the documentation could be improved then, since it doesn't mention anything about tags.

I got it wrong by following the example here:

{
    "core": "WordPress/WordPress#5.2.0",
    "plugins": [ "WordPress/wp-lazy-loading", "WordPress/classic-editor" ],
    "themes": [ "WordPress/theme-experiments" ]
}

@talldan
Copy link
Contributor

talldan commented Dec 17, 2020

Good catch!

@talldan talldan added the [Type] Developer Documentation Documentation for developers label Dec 17, 2020
@leoloso
Copy link
Author

leoloso commented Dec 17, 2020

Also this:

If the history doesn't belong to the project but to wp-env, then how I can force it to truly install the latest version of WP? The documentation doesn't mention this.

Can this be done? Is it a documentation issue? Or there's no way currently to say "use the latest WP" and I need to explicitly use the latest tag?

@swissspidy
Copy link
Member

If it's not a documentation feature but instead a lacking feature, it could be implemented by fetching the version information from http://api.wordpress.org/core/version-check/1.7/

Note the http. http serves a single offer, whereas https serves multiple. we only want one.

@noisysocks
Copy link
Member

core: null instructs wp-env to use whatever version of WordPress comes in the wordpress Docker image. Probably that image needs to be updated.

@noahtallen
Copy link
Member

Yeah, @noisysocks is spot on. They seem to update that image fairly quickly. In this case, it was updated to 5.6 the day of the release (december 8). So then the question is: why were you still getting an out of date image after that point? I think this would be because Docker is using a cached version of the image on your system. (That's my best guess anyways.) If you run wp-env start --update, it will update the docker image for you, which should resolve the problem if I'm right about the image being cached.

I think our action items here are to update the documentation about this behavior, and to fix the example with the git tag

@leoloso
Copy link
Author

leoloso commented Jan 7, 2021

If you run wp-env start --update, it will update the docker image for you, which should resolve the problem if I'm right about the image being cached.

I just tried this, both on an existing installation, and on a new one. It didn't solve the issue: It still installs WP 5.4.2.


Just in case it helps, this is the output in the terminal:

$ wp-env start --update --debug
ℹ Config:
{
    "name": "wp-env-new",
    "configDirectoryPath": "/Users/mac/Temporary/wp-env-new",
    "workDirectoryPath": "/Users/mac/.wp-env/95e90ef32f3edbefda6b5b3e4dc124b6",
    "port": 7088,
    "testsPort": 7089,
    "dockerComposeConfigPath": "/Users/mac/.wp-env/95e90ef32f3edbefda6b5b3e4dc124b6/docker-compose.yml",
    "coreSource": null,
    "pluginSources": [
        {
            "type": "local",
            "path": "/Users/mac/GitRepos/GitHub/Plugins/GraphQLAPI/graphql-api-for-wp",
            "basename": "graphql-api-for-wp"
        }
    ],
    "themeSources": [],
    "config": {
        "WP_DEBUG_DISPLAY": true,
        "GRAPHQL_API_PLUGIN_ENVIRONMENT": "development",
        "WP_TESTS_DOMAIN": "localhost:7089"
    },
    "mappings": {},
    "debug": true
}

Docker Compose Config:
{
    "version": "3.7",
    "services": {
        "mysql": {
            "image": "mariadb",
            "ports": [
                "3306"
            ],
            "environment": {
                "MYSQL_ALLOW_EMPTY_PASSWORD": "yes"
            },
            "volumes": [
                "mysql:/var/lib/mysql"
            ]
        },
        "wordpress": {
            "depends_on": [
                "mysql"
            ],
            "image": "wordpress",
            "ports": [
                "${WP_ENV_PORT:-7088}:80"
            ],
            "environment": {
                "WORDPRESS_DB_NAME": "wordpress"
            },
            "volumes": [
                "wordpress:/var/www/html",
                "/Users/mac/GitRepos/GitHub/Plugins/GraphQLAPI/graphql-api-for-wp:/var/www/html/wp-content/plugins/graphql-api-for-wp"
            ]
        },
        "tests-wordpress": {
            "depends_on": [
                "mysql"
            ],
            "image": "wordpress",
            "ports": [
                "${WP_ENV_TESTS_PORT:-7089}:80"
            ],
            "environment": {
                "WORDPRESS_DB_NAME": "tests-wordpress"
            },
            "volumes": [
                "tests-wordpress:/var/www/html",
                "/Users/mac/GitRepos/GitHub/Plugins/GraphQLAPI/graphql-api-for-wp:/var/www/html/wp-content/plugins/graphql-api-for-wp"
            ]
        },
        "cli": {
            "depends_on": [
                "wordpress"
            ],
            "image": "wordpress:cli",
            "volumes": [
                "wordpress:/var/www/html",
                "/Users/mac/GitRepos/GitHub/Plugins/GraphQLAPI/graphql-api-for-wp:/var/www/html/wp-content/plugins/graphql-api-for-wp"
            ],
            "user": "33:33"
        },
        "tests-cli": {
            "depends_on": [
                "tests-wordpress"
            ],
            "image": "wordpress:cli",
            "volumes": [
                "tests-wordpress:/var/www/html",
                "/Users/mac/GitRepos/GitHub/Plugins/GraphQLAPI/graphql-api-for-wp:/var/www/html/wp-content/plugins/graphql-api-for-wp"
            ],
            "user": "33:33"
        },
        "composer": {
            "image": "composer",
            "volumes": [
                "/Users/mac/Temporary/wp-env-new:/app"
            ]
        },
        "phpunit": {
            "image": "wordpressdevelop/phpunit:${LOCAL_PHP-latest}",
            "depends_on": [
                "tests-wordpress"
            ],
            "volumes": [
                "tests-wordpress:/var/www/html",
                "/Users/mac/GitRepos/GitHub/Plugins/GraphQLAPI/graphql-api-for-wp:/var/www/html/wp-content/plugins/graphql-api-for-wp",
                "phpunit-uploads:/var/www/html/wp-content/uploads"
            ],
            "environment": {
                "LOCAL_DIR": "html",
                "WP_PHPUNIT__TESTS_CONFIG": "/var/www/html/phpunit-wp-config.php"
            }
        }
    },
    "volumes": {
        "wordpress": {},
        "tests-wordpress": {},
        "mysql": {},
        "phpunit-uploads": {}
    }
}
⠏ Stopping WordPress.Removing network 95e90ef32f3edbefda6b5b3e4dc124b6_default
Network 95e90ef32f3edbefda6b5b3e4dc124b6_default not found.
ℹ Config:
{
    "name": "wp-env-new",
    "configDirectoryPath": "/Users/mac/Temporary/wp-env-new",
    "workDirectoryPath": "/Users/mac/.wp-env/95e90ef32f3edbefda6b5b3e4dc124b6",
    "port": 7088,
    "testsPort": 7089,
    "dockerComposeConfigPath": "/Users/mac/.wp-env/95e90ef32f3edbefda6b5b3e4dc124b6/docker-compose.yml",
    "coreSource": null,
    "pluginSources": [
        {
            "type": "local",
            "path": "/Users/mac/GitRepos/GitHub/Plugins/GraphQLAPI/graphql-api-for-wp",
            "basename": "graphql-api-for-wp"
        }
    ],
    "themeSources": [],
    "config": {
        "WP_DEBUG_DISPLAY": true,
        "GRAPHQL_API_PLUGIN_ENVIRONMENT": "development",
        "WP_TESTS_DOMAIN": "localhost:7089"
    },
    "mappings": {},
    "debug": true
}

Docker Compose Config:
{
    "version": "3.7",
    "services": {
        "mysql": {
            "image": "mariadb",
            "ports": [
                "3306"
            ],
            "environment": {
                "MYSQL_ALLOW_EMPTY_PASSWORD": "yes"
            },
            "volumes": [
                "mysql:/var/lib/mysql"
            ]
        },
        "wordpress": {
            "depends_on": [
                "mysql"
            ],
            "image": "wordpress",
            "ports": [
                "${WP_ENV_PORT:-7088}:80"
            ],
            "environment": {
                "WORDPRESS_DB_NAME": "wordpress"
            },
            "volumes": [
                "wordpress:/var/www/html",
                "/Users/mac/GitRepos/GitHub/Plugins/GraphQLAPI/graphql-api-for-wp:/var/www/html/wp-content/plugins/graphql-api-for-wp"
            ]
        },
        "tests-wordpress": {
            "depends_on": [
                "mysql"
            ],
            "image": "wordpress",
            "ports": [
                "${WP_ENV_TESTS_PORT:-7089}:80"
            ],
            "environment": {
                "WORDPRESS_DB_NAME": "tests-wordpress"
            },
            "volumes": [
                "tests-wordpress:/var/www/html",
                "/Users/mac/GitRepos/GitHub/Plugins/GraphQLAPI/graphql-api-for-wp:/var/www/html/wp-content/plugins/graphql-api-for-wp"
            ]
        },
        "cli": {
            "depends_on": [
                "wordpress"
            ],
            "image": "wordpress:cli",
            "volumes": [
                "wordpress:/var/www/html",
                "/Users/mac/GitRepos/GitHub/Plugins/GraphQLAPI/graphql-api-for-wp:/var/www/html/wp-content/plugins/graphql-api-for-wp"
            ],
            "user": "33:33"
        },
        "tests-cli": {
            "depends_on": [
                "tests-wordpress"
            ],
            "image": "wordpress:cli",
            "volumes": [
                "tests-wordpress:/var/www/html",
                "/Users/mac/GitRepos/GitHub/Plugins/GraphQLAPI/graphql-api-for-wp:/var/www/html/wp-content/plugins/graphql-api-for-wp"
            ],
            "user": "33:33"
        },
        "composer": {
            "image": "composer",
            "volumes": [
                "/Users/mac/Temporary/wp-env-new:/app"
            ]
        },
        "phpunit": {
            "image": "wordpressdevelop/phpunit:${LOCAL_PHP-latest}",
            "depends_on": [
                "tests-wordpress"
            ],
            "volumes": [
                "tests-wordpress:/var/www/html",
                "/Users/mac/GitRepos/GitHub/Plugins/GraphQLAPI/graphql-api-for-wp:/var/www/html/wp-content/plugins/graphql-api-for-wp",
                "phpunit-uploads:/var/www/html/wp-content/uploads"
            ],
            "environment": {
                "LOCAL_DIR": "html",
                "WP_PHPUNIT__TESTS_CONFIG": "/var/www/html/phpunit-wp-config.php"
            }
        }
    },
    "volumes": {
        "wordpress": {},
        "tests-wordpress": {},
        "mysql": {},
        "phpunit-uploads": {}
    }
}
⠇ Downloading WordPress.Creating network "95e90ef32f3edbefda6b5b3e4dc124b6_default" with the default driver
⠋ Downloading WordPress.Creating volume "95e90ef32f3edbefda6b5b3e4dc124b6_wordpress" with default driver
Creating volume "95e90ef32f3edbefda6b5b3e4dc124b6_tests-wordpress" with default driver
Creating volume "95e90ef32f3edbefda6b5b3e4dc124b6_mysql" with default driver
Creating volume "95e90ef32f3edbefda6b5b3e4dc124b6_phpunit-uploads" with default driver
Creating 95e90ef32f3edbefda6b5b3e4dc124b6_mysql_1 ... done
⠏ Starting WordPress.95e90ef32f3edbefda6b5b3e4dc124b6_mysql_1 is up-to-date
Creating 95e90ef32f3edbefda6b5b3e4dc124b6_wordpress_1       ... done
Creating 95e90ef32f3edbefda6b5b3e4dc124b6_tests-wordpress_1 ... done
Creating 95e90ef32f3edbefda6b5b3e4dc124b6_cli_run ... done
⠋ Starting WordPress.mysqlcheck: Got error: 2002: Can't connect to MySQL server on 'mysql' (115) when trying to connect
Creating 95e90ef32f3edbefda6b5b3e4dc124b6_cli_run ... done
⠸ Starting WordPress.mysqlcheck: Got error: 2002: Can't connect to MySQL server on 'mysql' (115) when trying to connect
Creating 95e90ef32f3edbefda6b5b3e4dc124b6_cli_run ... done
⠸ Starting WordPress.mysqlcheck: Got error: 2002: Can't connect to MySQL server on 'mysql' (115) when trying to connect
Creating 95e90ef32f3edbefda6b5b3e4dc124b6_cli_run ... done
⠋ Starting WordPress.mysqlcheck: Got error: 2002: Can't connect to MySQL server on 'mysql' (115) when trying to connect
Creating 95e90ef32f3edbefda6b5b3e4dc124b6_cli_run ... done
⠧ Starting WordPress.Success: Database checked.
⠇ Starting WordPress.Creating 95e90ef32f3edbefda6b5b3e4dc124b6_cli_run ... 
Creating 95e90ef32f3edbefda6b5b3e4dc124b6_tests-cli_run ... done
⠏ Starting WordPress.Success: WordPress installed successfully.
⠼ Starting WordPress.Success: WordPress installed successfully.
Creating 95e90ef32f3edbefda6b5b3e4dc124b6_cli_run ... done
Creating 95e90ef32f3edbefda6b5b3e4dc124b6_tests-cli_run ... done
⠇ Starting WordPress.Success: Added the constant 'WP_DEBUG_DISPLAY' to the 'wp-config.php' file with the raw value 'true'.
⠦ Starting WordPress.Success: Added the constant 'WP_DEBUG_DISPLAY' to the 'wp-config.php' file with the raw value 'true'.
Creating 95e90ef32f3edbefda6b5b3e4dc124b6_cli_run ... done
Creating 95e90ef32f3edbefda6b5b3e4dc124b6_tests-cli_run ... done
⠇ Starting WordPress.Success: Added the constant 'GRAPHQL_API_PLUGIN_ENVIRONMENT' to the 'wp-config.php' file with the value 'development'.
⠦ Starting WordPress.Success: Added the constant 'GRAPHQL_API_PLUGIN_ENVIRONMENT' to the 'wp-config.php' file with the value 'development'.
Creating 95e90ef32f3edbefda6b5b3e4dc124b6_cli_run ... done
Creating 95e90ef32f3edbefda6b5b3e4dc124b6_tests-cli_run ... done
⠋ Starting WordPress.Success: Added the constant 'WP_TESTS_DOMAIN' to the 'wp-config.php' file with the value 'localhost:7089'.
Success: Added the constant 'WP_TESTS_DOMAIN' to the 'wp-config.php' file with the value 'localhost:7089'.
Creating 95e90ef32f3edbefda6b5b3e4dc124b6_cli_run ... done
Creating 95e90ef32f3edbefda6b5b3e4dc124b6_tests-cli_run ... done
⠏ Starting WordPress.Warning: Could not activate the 'graphql-api-for-wp' plugin.
Success: Activated 1 of 1 plugins.
⠙ Starting WordPress.Warning: Could not activate the 'graphql-api-for-wp' plugin.
⠹ Starting WordPress.Success: Activated 1 of 1 plugins.
✔ WordPress started. (in 82s 465ms)

@mburridge
Copy link
Contributor

mburridge commented Jun 8, 2023

I am not able to reproduce this problem. It's over two years old so it may have been fixed. Is there still a documentation issue outstanding? I'm going to close this, given the lack of activity over the last couple of years, but feel free to let me know if you feel it's still relevant and I'll re-open it.

@noahtallen noahtallen removed the [Type] Developer Documentation Documentation for developers label Jun 13, 2023
@noahtallen
Copy link
Member

The wp-env behavior has definitely been updated so that the latest version is pulled more quickly, which matches the documented behavior. (So I removed the documentation label)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Tool] Env /packages/env [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

6 participants