Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Update to core 0.6.6, project -> projectId #286

Merged
merged 7 commits into from
Aug 31, 2018
Merged

Conversation

loosebazooka
Copy link
Contributor

@loosebazooka loosebazooka commented Aug 29, 2018

fixes #284

@loosebazooka
Copy link
Contributor Author

PR coming up in appengine-plugins-core to read gcloud config that should let the user get data from gcloud state.

@loosebazooka loosebazooka changed the title Update to core 0.6.5, project -> projectId Update to core 0.6.6, project -> projectId Aug 30, 2018
Copy link
Contributor Author

@loosebazooka loosebazooka left a comment

Choose a reason for hiding this comment

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

A lot of these changes are naming/fixing tests related to processing names. Marked what I think are important logic spots.

import org.xml.sax.SAXException;


public final class ConfigReader {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change is here: extract out config reader for easier sharing.


// configure the runExtension's project parameter
// assign the run project to the deploy project if none is specified
if (Strings.isNullOrEmpty(runExtension.getProjectId())) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change here: run's new paramter "projectId" is processed at configuration time.

+ GCLOUD_CONFIG
+ "' to use project from gcloud config.\n"
+ "3. Using "
+ APPENGINE_CONFIG
+ " is not allowed for flexible environment projects");
} else if (configString.equals(GCLOUD_CONFIG)) {
return null;
return ConfigReader.from(gcloud).getProject();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change here: now reads in the config instead of delegating to gcloud.

deploy.setDeployTargetResolver(new StandardDeployTargetResolver(appengineWebXml));

// configure the deploy extensions's project/version parameters
StandardDeployTargetResolver resolver =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change here: deploy now computers at configuration time the projectId and version.

} else if (configString.equals(GCLOUD_CONFIG)) {
return null;
return ConfigReader.from(gcloud).getProject();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change here: read gcloud project id at config time.

}

/** Return "application" tag from appengine-web.xml or error out if could not read. */
public String getProject() {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could this be "combined" with getVersion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was trying to contain all exceptions and exception handling in the methods themselves. But I guess I could potentially move the parsing to the constructor and still have almost the same effect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it turns out the call to getProjectId is still doing some Dom Processing, so I don't think we get too much from refactoring out initializing the appengineDescriptor

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or were you saying just returning project+version from one method?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh yea, I was just referring to refactoring them together, but since it doesn't same much, this is good.


DeployExtension deploy =
p.getExtensions().getByType(AppEngineStandardExtension.class).getDeploy();
deploy.setProjectId("project");
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these sets necessary? (I see the same being set on the deploy extension in the test build.gradle files)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, this programmatic creation of the project isn't using a build file. And since we're resolving project/version a little earlier in the build, it will fail at configuration time if they're not set.

USER_GUIDE.md Outdated
Caution: The v2-alpha version of the development web server is not fully
supported, and you may find errors when using this version.

To switch Dev App Server v2-alpha use the `serverVersion` parameter.
Copy link
Contributor

Choose a reason for hiding this comment

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

To switch back to the?

@@ -373,7 +377,7 @@ The `deploy` configuration has the following parameters :
| `appEngineDirectory` | Location of configuration files (cron.yaml, dos.yaml, etc) for configuration specific deployments. |
| `bucket` | The Google Cloud Storage bucket used to stage files associated with the deployment. |
| `imageUrl` | Deploy with a Docker URL from the Google container registry. |
| `project` | The Google Cloud Project target for this deployment. This can also be set to `GCLOUD_CONFIG`.\* |
| `projectId` | The Google Cloud Project target for this deployment. This can also be set to `GCLOUD_CONFIG`.\* |
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this one also be APPENGINE_CONFIG?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

flex doesn't allow appengine-web.xml based config. So they can't use APPENGINE_CONFIG here.

}

/** Return "application" tag from appengine-web.xml or error out if could not read. */
public String getProject() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, these could just be static methods?

ConfigReader#getProject(File appengineWebXml)
ConfigReader#getVersion(File appengineWebXml)
ConfigReader#getProject(Gcloud gcloud)

Copy link
Contributor Author

@loosebazooka loosebazooka Aug 31, 2018

Choose a reason for hiding this comment

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

yeah, good point.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DeployExtension project accessors are overloaded.
2 participants