Skip to content

Commit

Permalink
Feat/remove source image (#265)
Browse files Browse the repository at this point in the history
* feat: Remove source-image references from Tiltfile and READMEs

Given the implementation of the Local Source Proxy feature, users should no longer have to specify the --source-image field

* remove sourceRepositoryPrefix parameter
  • Loading branch information
mingxiao authored May 19, 2023
1 parent fccc3cf commit 689f195
Show file tree
Hide file tree
Showing 41 changed files with 16 additions and 103 deletions.
3 changes: 1 addition & 2 deletions .github/tests/java-rest-service-boot3/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
"exposeOpenAPIEndpoint": false,
"javaVersion": "17",
"databaseIntegrationTestType": "testcontainers",
"liveUpdateIDESupport": true,
"sourceRepositoryPrefix": "dev.local"
"liveUpdateIDESupport": true
}
3 changes: 1 addition & 2 deletions .github/tests/java-rest-service-maven+flyway+h2/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
"exposeOpenAPIEndpoint": false,
"javaVersion": "11",
"databaseIntegrationTestType": "in-memory",
"liveUpdateIDESupport": true,
"sourceRepositoryPrefix": "dev.local"
"liveUpdateIDESupport": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
"exposeOpenAPIEndpoint": false,
"javaVersion": "11",
"databaseIntegrationTestType": "testcontainers",
"liveUpdateIDESupport": true,
"sourceRepositoryPrefix": "dev.local"
"liveUpdateIDESupport": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
"exposeOpenAPIEndpoint": false,
"javaVersion": "11",
"databaseIntegrationTestType": "testcontainers",
"liveUpdateIDESupport": true,
"sourceRepositoryPrefix": "dev.local"
"liveUpdateIDESupport": true
}
3 changes: 1 addition & 2 deletions .github/tests/java-server-side-ui-maven+nosso/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
"groupId": "com.example",
"packageName": "com.example.serversideuistarter",
"javaVersion": "11",
"liveUpdateIDESupport": true,
"sourceRepositoryPrefix": "dev.local"
"liveUpdateIDESupport": true
}
1 change: 0 additions & 1 deletion .github/tests/spring-cloud-serverless-1/options.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"deploymentType": "workload",
"sourceRepositoryPrefix": "dev.local",
"javaVersion": "11"
}
3 changes: 1 addition & 2 deletions .github/tests/tap-initialize-1/options.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"targetProject": "target-project",
"includeHasTests": false,
"liveUpdateIDESupport": true,
"sourceRepositoryPrefix": "dev.local"
"liveUpdateIDESupport": true
}
5 changes: 2 additions & 3 deletions angular-frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,13 @@ Using the Tanzu CLI you could apply the workload using the local sources:
```bash
tanzu apps workload apply \
--file config/workload.yaml \
--namespace <namespace> --source-image <image-registry> \
--namespace <namespace> \
--local-path . \
--yes \
--tail
````

Note: change the namespace to where you would like to deploy this workload. Also define the (private) image registry you
are allowed to push the source-image, like: `docker.io/username/repository`.
Note: change the namespace to where you would like to deploy this workload.

--- StartAuthorization
### Authorization
Expand Down
5 changes: 1 addition & 4 deletions csharp-rest-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ tanzu apps workload apply -f config/workload.yaml
Deploy your app from your local working directory by running:

```script
tanzu apps workload create csharp-rest-service -f config/workload.yaml --local-path . --source-image <REPOSITORY-PREFIX>/csharp-rest-service-source --type web
tanzu apps workload create csharp-rest-service -f config/workload.yaml --local-path . --type web
```

## Accessing the app deployed to your cluster
Expand All @@ -54,10 +54,7 @@ You will have to update some fields in the root directory's `Tiltfile` to connec

Update the `allow_k8s_contexts` line of the `Tiltfile` to indicate the Kubernetes context to use.

Update the `Tiltfile` or set the SOURCE_IMAGE environment variable to indicate the registry path where TAP should store your image.

```script
export SOURCE_IMAGE=registry/project/csharp-rest-service
export K8S_TEST_CONTEXT="a-kubernetes-context"
tilt up
tilt down
Expand Down
2 changes: 0 additions & 2 deletions csharp-rest-service/Tiltfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
SOURCE_IMAGE = os.getenv("SOURCE_IMAGE", default='your-registry.io/project/csharp-rest-service-source') # update registry
LOCAL_PATH = os.getenv("LOCAL_PATH", default='.')
NAMESPACE = os.getenv("NAMESPACE", default='default')
NAME = "csharp-rest-service"
Expand All @@ -7,7 +6,6 @@ k8s_custom_deploy(
NAME,
apply_cmd="tanzu apps workload apply -f config/workload.yaml --update-strategy replace --debug --live-update" +
" --local-path " + LOCAL_PATH +
" --source-image " + SOURCE_IMAGE +
" --namespace " + NAMESPACE +
" --build-env BP_DEBUG_ENABLED=true" +
" --yes " +
Expand Down
3 changes: 0 additions & 3 deletions fragments/live-update/DEPLOYING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ Follow [instructions in the documentation](https://docs.vmware.com/en/Tanzu-Appl

These are the basic steps to use live update:

1. In Visual Studio Code, navigate to `Preferences > Settings > Extensions > Tanzu`.
- In the `Source Image` field, provide the destination image repository to publish an image containing your workload source code. This should match what is specified for `SOURCE_IMAGE` default in the Tiltfile.
1. From the Command Palette (⇧⌘P), type "Tanzu", and select `Tanzu: Live Update Start`. You can view output from Tanzu Application Platform and from Tilt indicating that the container is being built and deployed.
- You see "Live Update starting..." in the status bar at the bottom right.
- Live update can take 1-3 minutes while the workload deploys and the Knative service becomes available.
Expand Down Expand Up @@ -40,7 +38,6 @@ If you would like deploy the code from your local working directory you can use
```
tanzu apps workload create my-project -f config/workload.yaml \
--local-path . \
--source-image dev.local/my-project-source \
--type web
```
Expand Down
2 changes: 0 additions & 2 deletions fragments/live-update/Tiltfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
SOURCE_IMAGE = os.getenv("SOURCE_IMAGE", default='dev.local/my-project-source')
LOCAL_PATH = os.getenv("LOCAL_PATH", default='.')
NAMESPACE = os.getenv("NAMESPACE", default='default')

k8s_custom_deploy(
'my-project',
apply_cmd="tanzu apps workload apply -f config/workload.yaml --update-strategy replace --debug --live-update" +
" --local-path " + LOCAL_PATH +
" --source-image " + SOURCE_IMAGE +
" --namespace " + NAMESPACE +
" --yes --output yaml",
delete_cmd="tanzu apps workload delete -f config/workload.yaml --namespace " + NAMESPACE + " --yes",
Expand Down
18 changes: 1 addition & 17 deletions fragments/live-update/accelerator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ accelerator:
dataType: boolean
defaultValue: true

- name: sourceRepositoryPrefix
inputType: text
label: The source image repository prefix to use when pushing the source
description: The prefix for the source image repository where source can be stored during development
defaultValue: dev.local
dependsOn:
name: liveUpdateIDESupport

engine:
merge:
- condition: "#liveUpdateIDESupport"
Expand All @@ -25,18 +17,10 @@ engine:
substitutions:
- text: my-project
with: "#artifactId"
- type: ReplaceText
substitutions:
- text: dev.local
with: "#sourceRepositoryPrefix"
- condition: "#liveUpdateIDESupport"
include: ["DEPLOYING.md"]
chain:
- type: ReplaceText
substitutions:
- text: my-project
with: "#artifactId"
- type: ReplaceText
substitutions:
- text: dev.local
with: "#sourceRepositoryPrefix"
with: "#artifactId"
1 change: 0 additions & 1 deletion fragments/tap-initialize/DEPLOYING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ If you would like to deploy the code from your local working directory you can u
```
tanzu apps workload create my-project -f config/workload.yaml \
--local-path . \
--source-image <REPOSITORY-PREFIX>/my-project-source \
--type web
```

Expand Down
4 changes: 0 additions & 4 deletions java-function/DEPLOYING.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ If you would like deploy the code from your local working directory you can use
```
tanzu apps workload create java-function -f config/workload.yaml \
--local-path . \
--source-image <REPOSITORY-PREFIX>/java-function-source \
--type web
```

Expand Down Expand Up @@ -152,10 +151,7 @@ You will have to update some fields in the root directory's `Tiltfile` to connec

Update the `allow_k8s_contexts` line of the `Tiltfile` to indicate the Kubernetes context to use.

Update the `Tiltfile` or set the SOURCE_IMAGE environment variable to indicate the registry path where TAP should store your image.

```
export SOURCE_IMAGE=registry/project/java-function
export K8S_TEST_CONTEXT="a-kubernetes-context"
tilt up
tilt down
Expand Down
2 changes: 0 additions & 2 deletions java-function/Tiltfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# You will need to modify this file to enable Tilt live debugging
SOURCE_IMAGE = os.getenv("SOURCE_IMAGE", default='source-image-location') # CHANGEME - replace `source-image-location` with your writable repository
LOCAL_PATH = os.getenv("LOCAL_PATH", default='.')
NAMESPACE = os.getenv("NAMESPACE", default='default')

Expand All @@ -9,7 +8,6 @@ k8s_custom_deploy(
'java-function',
apply_cmd="tanzu apps workload apply -f config/workload.yaml --update-strategy replace --debug --live-update" +
" --local-path " + LOCAL_PATH +
" --source-image " + SOURCE_IMAGE +
" --namespace " + NAMESPACE +
" --yes --output yaml",
delete_cmd="tanzu apps workload delete -f config/workload.yaml --namespace " + NAMESPACE + " --yes" ,
Expand Down
4 changes: 1 addition & 3 deletions java-rest-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,12 @@ Using the Tanzu CLI one could apply the workload using the local sources:
tanzu apps workload apply \
--file config/workload.yaml \
--namespace <workload-namespace> \
--source-image <image-registry> \
--local-path . \
--yes \
--tail
```

Note: change the namespace to where you would like to deploy this workload. Also define the (private) image registry you
are allowed to push the source-image, like: `docker.io/username/repository`.
Note: change the namespace to where you would like to deploy this workload.

### Visual Studio Code Tanzu Plugin

Expand Down
5 changes: 2 additions & 3 deletions java-server-side-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,13 @@ Using the Tanzu CLI one could apply the workload using the local sources:
```bash
tanzu apps workload apply \
--file config/workload.yaml \
--namespace <namespace> --source-image <image-registry> \
--namespace <namespace> \
--local-path . \
--yes \
--tail
````

> Change the namespace to where you would like to deploy this workload. Also define the (private) image registry you
are allowed to push the source-image, like: `docker.io/username/repository`.
> Change the namespace to where you would like to deploy this workload.

### Visual Studio Code Tanzu Plugin
When developing locally but would like to deploy the local code to the cluster, the Tanzu Plugin could help.
Expand Down
1 change: 0 additions & 1 deletion node-express/DEPLOYING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ If you would like deploy the code from your local working directory you can use
```
tanzu apps workload create node-express -f config/workload.yaml \
--local-path . \
--source-image <REPOSITORY-PREFIX>/node-express-source \
--type web
```

Expand Down
4 changes: 0 additions & 4 deletions node-function/DEPLOYING.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ If you would like deploy the code from your local working directory you can use
```
tanzu apps workload create node-function -f config/workload.yaml \
--local-path . \
--source-image <REPOSITORY-PREFIX>/node-function-source \
--type web
```

Expand All @@ -91,10 +90,7 @@ You may use [tilt](https://github.com/tilt-dev/tilt) `>v0.27.2` in combination w

Update the `allow_k8s_contexts` line of the `Tiltfile` to indicate the Kubernetes context to use.

Update the `Tiltfile` or set the SOURCE_IMAGE environment variable to indicate the registry path where TAP should store your image.

```
export SOURCE_IMAGE=registry/project/node-function
export K8S_TEST_CONTEXT="a-kubernetes-context"
tilt up
tilt down
Expand Down
2 changes: 0 additions & 2 deletions node-function/Tiltfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# You will need to modify this file to enable Tilt live debugging
SOURCE_IMAGE = os.getenv("SOURCE_IMAGE", default='source-image-location') # CHANGEME - replace `source-image-location` with your writable repository
LOCAL_PATH = os.getenv("LOCAL_PATH", default='.')
NAMESPACE = os.getenv("NAMESPACE", default='default')
K8S_TEST_CONTEXT = os.getenv("K8S_TEST_CONTEXT", default='')
Expand All @@ -10,7 +9,6 @@ k8s_custom_deploy(
'node-function',
apply_cmd="tanzu apps workload apply -f config/workload.yaml --update-strategy replace --debug --live-update" +
" --local-path " + LOCAL_PATH +
" --source-image " + SOURCE_IMAGE +
" --namespace " + NAMESPACE +
" --yes --output yaml",
delete_cmd="tanzu apps workload delete -f config/workload.yaml --namespace " + NAMESPACE + " --yes" ,
Expand Down
3 changes: 1 addition & 2 deletions node-function/test.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/bin/bash
set -e

# Prerequisites: set these two environment variables for the Tiltfile
#SOURCE_IMAGE
# Prerequisites: set environment variable(s) for the Tiltfile
#K8S_TEST_CONTEXT

# Delete the previous run
Expand Down
1 change: 0 additions & 1 deletion python-function/DEPLOYING.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ If you would like deploy the code from your local working directory you can use
```
tanzu apps workload create python-function -f config/workload.yaml \
--local-path . \
--source-image <REPOSITORY-PREFIX>/python-function-source \
--type web
```

Expand Down
2 changes: 0 additions & 2 deletions python-web-app/Tiltfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
SOURCE_IMAGE = os.getenv("SOURCE_IMAGE", default='dev.local/python-web-app-source')
LOCAL_PATH = os.getenv("LOCAL_PATH", default='.')
NAMESPACE = os.getenv("NAMESPACE", default='default')
OUTPUT_TO_NULL_COMMAND = os.getenv("OUTPUT_TO_NULL_COMMAND", default=' > /dev/null ')
Expand All @@ -7,7 +6,6 @@ k8s_custom_deploy(
'python-web-app',
apply_cmd="tanzu apps workload apply -f config/workload.yaml --update-strategy replace --debug --live-update" +
" --local-path " + LOCAL_PATH +
" --source-image " + SOURCE_IMAGE +
" --namespace " + NAMESPACE +
" --yes " +
OUTPUT_TO_NULL_COMMAND +
Expand Down
5 changes: 2 additions & 3 deletions react-frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,13 @@ Using the Tanzu CLI one could apply the workload using the local sources:
```bash
tanzu apps workload apply \
--file config/workload.yaml \
--namespace <namespace> --source-image <image-registry> \
--namespace <namespace> \
--local-path . \
--yes \
--tail
````

Note: change the namespace to where you would like to deploy this workload. Also define the (private) image registry you
are allowed to push the source-image, like: `docker.io/username/repository`.
Note: change the namespace to where you would like to deploy this workload.

### Visual Studio Code Tanzu Plugin
When developing local but would like to deploy the local code to the cluster the Tanzu Plugin could help.
Expand Down
3 changes: 0 additions & 3 deletions spring-cloud-serverless/kubernetes/tap/DEPLOYING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ Follow [instructions in the documentation](https://docs.vmware.com/en/Tanzu-Appl

These are the basic steps to use live update:

1. In Visual Studio Code, navigate to `Preferences > Settings > Extensions > Tanzu`.
- In the `Source Image` field, provide the destination image repository to publish an image containing your workload source code. This should match what is specified for `SOURCE_IMAGE` default in the Tiltfile.
1. From the Command Palette (⇧⌘P), type "Tanzu", and select `Tanzu: Live Update Start`. You can view output from Tanzu Application Platform and from Tilt indicating that the container is being built and deployed.
- You see "Live Update starting..." in the status bar at the bottom right.
- Live update can take 1-3 minutes while the workload deploys and the Knative service becomes available.
Expand Down Expand Up @@ -40,7 +38,6 @@ If you would like deploy the code from your local working directory you can use
```
tanzu apps workload create hello-fun -f config/workload.yaml \
--local-path . \
--source-image <REPOSITORY-PREFIX>/hello-fun-source \
--type web
```
Expand Down
2 changes: 0 additions & 2 deletions spring-cloud-serverless/kubernetes/tap/Tiltfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
SOURCE_IMAGE = os.getenv("SOURCE_IMAGE", default='dev.local/hello-fun-source')
LOCAL_PATH = os.getenv("LOCAL_PATH", default='.')
NAMESPACE = os.getenv("NAMESPACE", default='default')

k8s_custom_deploy(
'hello-fun',
apply_cmd="tanzu apps workload apply -f config/workload.yaml --update-strategy replace --debug --live-update" +
" --local-path " + LOCAL_PATH +
" --source-image " + SOURCE_IMAGE +
" --namespace " + NAMESPACE +
" --yes --output yaml",
delete_cmd="tanzu apps workload delete -f config/workload.yaml --namespace " + NAMESPACE + " --yes",
Expand Down
2 changes: 0 additions & 2 deletions spring-smtp-gateway/smtp-gateway/Tiltfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
SOURCE_IMAGE = os.getenv("SOURCE_IMAGE", default='your-registry.io/project/smtp-gateway-source')
LOCAL_PATH = os.getenv("LOCAL_PATH", default='.')
NAMESPACE = os.getenv("NAMESPACE", default='default')

k8s_custom_deploy(
'spring-smtp-gateway',
apply_cmd="tanzu apps workload apply -f config/workload.yaml --update-strategy replace --debug --live-update" +
" --local-path " + LOCAL_PATH +
" --source-image " + SOURCE_IMAGE +
" --namespace " + NAMESPACE +
" --yes --output yaml",
delete_cmd="tanzu apps workload delete -f config/workload.yaml --namespace " + NAMESPACE + " --yes" ,
Expand Down
2 changes: 0 additions & 2 deletions spring-smtp-gateway/smtp-sink/Tiltfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
SOURCE_IMAGE = os.getenv("SOURCE_IMAGE", default='your-registry.io/project/smtp-sink-source')
LOCAL_PATH = os.getenv("LOCAL_PATH", default='.')
NAMESPACE = os.getenv("NAMESPACE", default='default')

k8s_custom_deploy(
'smtp-sink',
apply_cmd="tanzu apps workload apply -f config/workload.yaml --update-strategy replace --debug --live-update" +
" --local-path " + LOCAL_PATH +
" --source-image " + SOURCE_IMAGE +
" --namespace " + NAMESPACE +
" --yes --output yaml",
delete_cmd="tanzu apps workload delete -f config/workload.yaml --namespace " + NAMESPACE + " --yes" ,
Expand Down
Loading

0 comments on commit 689f195

Please sign in to comment.