Skip to content

Commit

Permalink
Update libertyDev properties and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbsox committed Sep 21, 2023
1 parent 06f97aa commit d791ab9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
10 changes: 5 additions & 5 deletions docs/libertyDev.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ These can also be specified as command line parameters in addition to the ones i
| Attribute | Type | Since | Description | Required |
| --------- | ----- | ----- | ----------- | -------- |
| container | boolean | 3.1-M1 | If set to `true`, run the server in the container specified by the `containerfile` parameter. Setting this to `true` and using the `libertyDev` task is equivalent to using the `libertyDevc` task. The default value is `false` when the `libertyDev` task is used, and `true` when the `libertyDevc` task is used. | No |
| containerRunOpts | String | 3.1-M1 | Specifies options to add to the container `run` command when using dev mode to launch your server in a container. For example, `-e key=value` is recognized by `docker run` to define an environment variable with the name `key` and value `value`. | No |
| containerfile | File | 3.1-M1 | Location of a Containerfile or Dockerfile to be used by dev mode to build the image for the container that will run your Liberty server. The default location is `Containerfile` or `Dockerfile` in the project root. | No |
| cotnainerBuildContext | File | 3.1.3 | The container build context directory to be used by dev mode for the container `build` command. The default location is the directory of the Containerfile/Dockerfile. | No |
| containerBuildTimeout | integer | 3.1-M3 | Maximum time to wait (in seconds) for the completion of the container operation to build the image. The value must be an integer greater than 0. The default value is `600` seconds. | No |
| containerRunOpts | String | 3.7 | Specifies options to add to the container `run` command when using dev mode to launch your server in a container. For example, `-e key=value` is recognized by `docker run` to define an environment variable with the name `key` and value `value`. This attribute replaces the deprecated `dockerRunOpts` attribute. | No |
| containerfile | File | 3.7 | Location of a Containerfile or Dockerfile to be used by dev mode to build the image for the container that will run your Liberty server. The default location is `Containerfile` or `Dockerfile` in the project root. This attribute replaces the deprecated `dockerfile` attribute. | No |
| cotnainerBuildContext | File | 3.7 | The container build context directory to be used by dev mode for the container `build` command. The default location is the directory of the Containerfile/Dockerfile. This attribute replaces the deprecated `dockerBuildContext` attribute. | No |
| containerBuildTimeout | integer | 3.7 | Maximum time to wait (in seconds) for the completion of the container operation to build the image. The value must be an integer greater than 0. The default value is `600` seconds. This attribute replaces the deprecated `dockerBuildTimeout` attribute. | No |
| skipDefaultPorts | boolean | 3.1-M3 | If set to `true`, dev mode will not publish the default container port mappings of `9080:9080` (HTTP) and `9443:9443` (HTTPS). Use this option if you would like to specify alternative local ports to map to the exposed container ports for HTTP and HTTPS using the `containerRunOpts` parameter. | No |
| keepTempContainerfile | boolean | 3.1 | If set to `true`, dev mode will not delete the temporary modified copy of your Containerfile/Dockerfile used to build the container image. This file is handy in case you need to debug the process of building the container image. The path of the temporary Containerfile/Dockerfile can be seen when dev mode displays the container `build` command. The default value is `false`.| No |
| keepTempContainerfile | boolean | 3.7 | If set to `true`, dev mode will not delete the temporary modified copy of your Containerfile/Dockerfile used to build the container image. This file is handy in case you need to debug the process of building the container image. The path of the temporary Containerfile/Dockerfile can be seen when dev mode displays the container `build` command. The default value is `false`. This attribute replaces the deprecated `keepTempDockerfile` attribute. | No |
20 changes: 12 additions & 8 deletions src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class DevTask extends AbstractFeatureTask {
private String dockerRunOpts;
@Option(option = 'dockerRunOpts', description = 'Alias for containerRunOpts')
void setDockerRunOpts(String dockerRunOpts) {
if (containerRunOpts == null) {
if (dockerRunOpts != null && containerRunOpts == null) {
setContainerRunOpts(dockerRunOpts)
}
}
Expand All @@ -279,7 +279,9 @@ class DevTask extends AbstractFeatureTask {
private int dockerBuildTimeout;
@Option(option = 'dockerBuildTimeout', description = 'Alias for containerBuildTimeout')
void setDockerBuildTimeout(String inputValue) {
setContainerBuildTimeout(inputValue)
if (inputValue != null && containerBuildTimeout == null) {
setContainerBuildTimeout(inputValue)
}
}

private Boolean skipDefaultPorts;
Expand All @@ -299,7 +301,9 @@ class DevTask extends AbstractFeatureTask {
private Boolean keepTempDockerfile;
@Option(option = 'keepTempDockerfile', description = 'Alias for keepTempContainerfile')
void setKeepTempDockerfile(boolean keepTempDockerfile) {
setKeepTempContainerfile(keepTempDockerfile)
if (keepTempDockerfile != null && keepTempContainerfile == null) {
setKeepTempContainerfile(keepTempDockerfile)
}
}

@Optional
Expand Down Expand Up @@ -1340,28 +1344,28 @@ class DevTask extends AbstractFeatureTask {
}
}

if (containerfile == null) {
if (containerfile == null && dockerfile == null) {
File buildcontainerfileSetting = project.liberty.dev.containerfile; // get from build.gradle
if (buildcontainerfileSetting != null) {
setContainerfile(buildcontainerfileSetting.getAbsolutePath()); // setContainerfile will convert it to canonical path
}
}

if (containerBuildContext == null) {
if (containerBuildContext == null && dockerBuildContext == null) {
File buildContainerBuildContextSetting = project.liberty.dev.containerBuildContext; // get from build.gradle
if (buildContainerBuildContextSetting != null) {
setContainerBuildContext(buildContainerBuildContextSetting.getAbsolutePath()); // setContainerBuildContext will convert it to canonical path
}
}

if (containerRunOpts == null) {
if (containerRunOpts == null && dockerRunOpts == null) {
String buildContainerRunOptsSetting = project.liberty.dev.containerRunOpts; // get from build.gradle
if (buildContainerRunOptsSetting != null) {
setContainerRunOpts(buildContainerRunOptsSetting);
}
}

if (containerBuildTimeout == 0) {
if (containerBuildTimeout == 0 && dockerBuildTimeout == 0) {
String buildContainerBuildTimeoutSetting = project.liberty.dev.containerBuildTimeout; // get from build.gradle
if (buildContainerBuildTimeoutSetting != null) {
setContainerBuildTimeout(buildContainerBuildTimeoutSetting);
Expand All @@ -1377,7 +1381,7 @@ class DevTask extends AbstractFeatureTask {
}
}

if (keepTempContainerfile == null) {
if (keepTempContainerfile == null && keepTempDockerfile == null) {
boolean buildKeepTempContainerfileSetting = project.liberty.dev.keepTempContainerfile; // get from build.gradle
if (buildKeepTempContainerfileSetting == null) {
setKeepTempContainerfile(DEFAULT_KEEP_TEMP_CONTAINERFILE);
Expand Down

0 comments on commit d791ab9

Please sign in to comment.