diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index 0bbc8f95..c872b127 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -98,7 +98,15 @@ jobs: uses: actions/upload-artifact@v3 with: retention-days: 5 + name: binaries path: dist + - + name: Archive Linux binary + uses: actions/upload-artifact@v3 + with: + retention-days: 5 + name: linux-binary + path: dist/symfony-cli_linux_amd64.tar.gz - name: Install Cloudsmith CLI run: pip install --upgrade cloudsmith-cli diff --git a/envs/remote.go b/envs/remote.go index 47fdb9e1..7e6b7eea 100644 --- a/envs/remote.go +++ b/envs/remote.go @@ -55,7 +55,25 @@ func (r *Remote) Relationships() Relationships { if r.Debug { fmt.Fprint(os.Stderr, "PLATFORM_RELATIONSHIPS env var does not exist\n") } - return nil + + // during the build hook, force a database version to avoid having Doctrine + // trying to connect to the DB to guess it (as the DB is not available yet). + res := make(Relationships) + res["database"] = []map[string]interface{}{{ + "host": "127.0.0.1", + "ip": "127.0.0.1", + "username": "fake-dsn-for-build-hook", + "password": "as-db-is-never-available-yet", + "path": "nowhere", + "port": "3306", + "query": map[string]bool{ + "is_master": true, + }, + "rel": "mysql", + "scheme": "mysql", + "type": "mysql:13.37", + }} + return res } var err error diff --git a/envs/remote_test.go b/envs/remote_test.go index b3d511de..dc738a4d 100644 --- a/envs/remote_test.go +++ b/envs/remote_test.go @@ -256,7 +256,20 @@ func (s *RemoteSuite) TestDefaultRoute(c *C) { func (s *RemoteSuite) TestRelationships(c *C) { r := &Remote{} - c.Assert(extractRelationshipsEnvs(r), DeepEquals, Envs{}) + // build hook on psh + c.Assert(extractRelationshipsEnvs(r), DeepEquals, Envs{ + "DATABASE_DATABASE": "nowhere", + "DATABASE_DRIVER": "mysql", + "DATABASE_HOST": "127.0.0.1", + "DATABASE_NAME": "nowhere", + "DATABASE_PASSWORD": "as-db-is-never-available-yet", + "DATABASE_PORT": "3306", + "DATABASE_SERVER": "mysql://127.0.0.1:3306", + "DATABASE_URL": "mysql://fake-dsn-for-build-hook:as-db-is-never-available-yet@127.0.0.1:3306/nowhere?sslmode=disable&charset=utf8mb4&serverVersion=mariadb-13.37.0", + "DATABASE_USER": "fake-dsn-for-build-hook", + "DATABASE_USERNAME": "fake-dsn-for-build-hook", + "DATABASE_VERSION": "mariadb-13.37.0", + }) os.Setenv("PLATFORM_RELATIONSHIPS", "eyJzZWN1cml0eS1zZXJ2ZXIiOiBbeyJpcCI6ICIxNjkuMjU0LjI2LjIzMSIsICJob3N0IjogInNlY3VyaXR5LXNlcnZlci5pbnRlcm5hbCIsICJzY2hlbWUiOiAiaHR0cCIsICJwb3J0IjogODAsICJyZWwiOiAiaHR0cCJ9XSwgImRhdGFiYXNlIjogW3sidXNlcm5hbWUiOiAibWFpbiIsICJzY2hlbWUiOiAicGdzcWwiLCAiaXAiOiAiMTY5LjI1NC4xMjAuNDgiLCAiaG9zdCI6ICJkYXRhYmFzZS5pbnRlcm5hbCIsICJyZWwiOiAicG9zdGdyZXNxbCIsICJwYXRoIjogIm1haW4iLCAicXVlcnkiOiB7ImlzX21hc3RlciI6IHRydWV9LCAicGFzc3dvcmQiOiAibWFpbiIsICJwb3J0IjogNTQzMn1dfQ==") c.Assert(extractRelationshipsEnvs(r), DeepEquals, Envs{