Skip to content

Commit 72dda25

Browse files
committed
OSDOCS-71-75 add build environment modules
1 parent 2f187ff commit 72dda25

4 files changed

+85
-0
lines changed

builds/creating-build-inputs.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,9 @@ include::modules/builds-custom-strategy.adoc[leveloffset=+2]
9090
include::modules/builds-using-external-artifacts.adoc[leveloffset=+1]
9191

9292
include::modules/builds-docker-credentials-private-registries.adoc[leveloffset=+1]
93+
94+
include::modules/builds-build-environment.adoc[leveloffset=+1]
95+
96+
include::modules/builds-using-build-fields-as-environment-variables.adoc[leveloffset=+2]
97+
98+
include::modules/builds-using-secrets-as-environment-variables.adoc[leveloffset=+2]

modules/builds-build-environment.adoc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * assembly/builds
4+
5+
[id='builds-build-environment-{context}']
6+
= Build environments
7+
8+
As with pod environment variables, build environment variables can be defined in
9+
terms of references to other resources or variables using the Downward API.
10+
There are some exceptions, which are noted.
11+
12+
You can also manage environment variables defined in the `BuildConfig` with the
13+
`oc set env` command.
14+
15+
[NOTE]
16+
====
17+
Referencing container resources using `valueFrom` in build environment variables
18+
is not supported as the references are resolved before the container is created.
19+
====
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * assembly/builds
4+
5+
[id='builds-using-build-fields-as-environments-{context}']
6+
= Using build fields as environment variables
7+
8+
You can inject information about the build object by setting the `fieldPath`
9+
environment variable source to the `JsonPath` of the field from which you are
10+
interested in obtaining the value.
11+
12+
[NOTE]
13+
====
14+
Jenkins Pipeline strategy does not support `valueFrom` syntax for environment
15+
variables.
16+
====
17+
18+
.Procedure
19+
20+
* Set the `fieldPath` environment variable source to the `JsonPath` of the field
21+
from which you are interested in obtaining the value:
22+
+
23+
[source,yaml]
24+
----
25+
env:
26+
- name: FIELDREF_ENV
27+
valueFrom:
28+
fieldRef:
29+
fieldPath: metadata.name
30+
----
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * assembly/builds
4+
5+
[id='builds-using-secrets-as-environment-variables-{context}']
6+
= Using secrets as environment variables
7+
8+
You can make key values from Secrets available as environment variables using
9+
the `valueFrom` syntax.
10+
11+
.Procedure
12+
13+
* To use a secret as an environment variable, set the `valueFrom` syntax:
14+
+
15+
[source,yaml]
16+
----
17+
apiVersion: v1
18+
kind: BuildConfig
19+
metadata:
20+
name: secret-example-bc
21+
spec:
22+
strategy:
23+
sourceStrategy:
24+
env:
25+
- name: MYVAL
26+
valueFrom:
27+
secretKeyRef:
28+
key: myval
29+
name: mysecret
30+
----

0 commit comments

Comments
 (0)