You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _docs/ci-cd-guides/preview-environments.md
+11-13Lines changed: 11 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ caption="Dynamic Test environments"
19
19
max-width="90%"
20
20
%}
21
21
22
-
This way each developer is working in isolation and can test their feature on its own. This pattern comes in contrast withthe traditional way of reusing static preexisting environments.
22
+
This way each developer is working in isolation and can test their feature on its own. This pattern comes in contrast with the traditional way of reusing static preexisting environments.
23
23
24
24
{% include image.html
25
25
lightbox="true"
@@ -49,7 +49,7 @@ The two major approaches here are with host-based URLs or path based URLs.
49
49
* with path based URLs, the test environments are named`example.com/pr1` ,`example.com/pr2` and so on
50
50
51
51
Both approaches have advantages and disadvantages. Path based URLs are easier to setup but may not work with all applications (since they change the web context). Host based URLs are more robust but need extra
52
-
DNS configuration for the full effect
52
+
DNS configuration for the full effect.
53
53
54
54
In Kubernetes clusters, both ways can be setup via[an Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/).
55
55
@@ -63,7 +63,7 @@ The application we will use can be found at [https://github.com/codefresh-contri
63
63
64
64
We are using[the Ambassador gateway](https://www.getambassador.io/) as an ingress for this example, but you can use any other compliant Kubernetes Ingress.
65
65
66
-
Here is[ingress manifest](https://github.com/codefresh-contrib/unlimited-test-environments-manifests/blob/main/simple-java-app/templates/ingress.yaml)
66
+
Here isthe[ingress manifest](https://github.com/codefresh-contrib/unlimited-test-environments-manifests/blob/main/simple-java-app/templates/ingress.yaml)
67
67
68
68
{% highlight yaml %}
69
69
{% raw %}
@@ -96,7 +96,7 @@ Each time a Pull Request is created we want to perform the following tasks:
96
96
1. Create a namespace with the same name as the pull request branch. Deploy the pull Request and expose it as a URL
97
97
that has the same name as the branch as well
98
98
99
-
Here is an example pipeline that does all these tasks
99
+
Here is an example pipeline that does all these tasks:
The environment is also mentioned as a comment in the Pull Request UI inGituhub:
250
+
The environment is also mentioned as a comment in the Pull Request UI inGithub:
251
251
252
252
{% include image.html
253
253
lightbox="true"
@@ -259,7 +259,7 @@ max-width="100%"
259
259
%}
260
260
261
261
As explained it the[previous guide for Pull Requests]({{site.baseurl}}/docs/ci-cd-guides/pull-request-branches/), we want to make this pipeline applicable only
262
-
to PR open event and PR sync events (whichcaptures commits that happen on an existing pull request).
262
+
to PR open event and PR sync events (whichcapture commits that happen on an existing pull request).
263
263
264
264
{% include image.html
265
265
lightbox="true"
@@ -275,11 +275,9 @@ Therefore you need to setup your [triggers]({{site.baseurl}}/docs/configure-ci-c
275
275
##Cleaning up temporary environments
276
276
277
277
Creating temporary environments is very convenient for developers but can be very costly for your infrastructure if you use a cloud
278
-
provider for your cluster. For cost reasons and better resource utilization it is best if temporary environments are destroyed if they are
279
-
no longer used.
278
+
provider for your cluster. For cost reasons and better resource utilization it is best if temporary environments are destroyed if they are no longer used.
280
279
281
-
While you can run a batch job, that automatically deletes old temporary environments, the optimal approach is to delete them as soon as
282
-
the respective Pull Request is closed.
280
+
While you can run a batch job, that automatically deletes old temporary environments, the optimal approach is to delete them as soon as the respective Pull Request is closed.
283
281
284
282
We can do that with a very simple pipeline that has only one step:
285
283
@@ -313,9 +311,9 @@ steps:
313
311
{% endraw %}
314
312
{% endhighlight %}
315
313
316
-
The pipeline justuninstall the Helm release for that namespace and then deletes the namespace itself.
314
+
The pipeline justuninstalls the Helm release for that namespace and then deletes the namespace itself.
317
315
318
-
To have this pipeline run only when a Pull Request is closed here is how your[trigger]({{site.baseurl}}/docs/configure-ci-cd-pipeline/triggers/git-triggers/)should look:
316
+
To have this pipeline run only when a Pull Request is closed here is how your[trigger]({{site.baseurl}}/docs/configure-ci-cd-pipeline/triggers/git-triggers/) should look:
319
317
320
318
{% include image.html
321
319
lightbox="true"
@@ -326,7 +324,7 @@ caption="Git events for a Pull Request close pipeline"
326
324
max-width="100%"
327
325
%}
328
326
329
-
Notice that with this setupthat pipeline will run when the pull request was closed regardless ofwether it was merged or not (which is exactly what you want as in both cases the test environment is not needed anymore).
327
+
Notice that with this setupthe pipeline will run when the pull request was closed regardless ofwhether it was merged or not (which is exactly what you want as in both cases the test environment is not needed anymore).