|
| 1 | +# SPDX-FileCopyrightText: 2022 Chainguard, Inc |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | +# |
| 4 | +# This is a sample configuration file to demonstrate how to use the |
| 5 | +# pipeline needs.environment feature for build and test pipelines, |
| 6 | +# to inject transparently environment variables to the parent pipeline. |
| 7 | +# |
| 8 | +# For more information about melange's built-in golang support check out: |
| 9 | +# https://github.com/chainguard-dev/melange/blob/main/docs/BUILD-PROCESS.md |
| 10 | +# |
| 11 | +package: |
| 12 | + name: example |
| 13 | + version: 0.1.0 |
| 14 | + epoch: 0 |
| 15 | + |
| 16 | +environment: |
| 17 | + contents: |
| 18 | + packages: |
| 19 | + - busybox |
| 20 | + - ca-certificates-bundle |
| 21 | + keyring: |
| 22 | + - https://packages.wolfi.dev/os/wolfi-signing.rsa.pub |
| 23 | + repositories: |
| 24 | + - https://packages.wolfi.dev/os |
| 25 | + |
| 26 | +pipeline: |
| 27 | + - name: Expect an environment transparently. |
| 28 | + environment: |
| 29 | + FOO: "foo" |
| 30 | + runs: | |
| 31 | + set -u |
| 32 | + echo "FOO: ${FOO}" |
| 33 | + if [[ "${FOO}" != "foo" ]]; then |
| 34 | + echo "Expected FOO=foo, got FOO=${FOO}" |
| 35 | + exit 1 |
| 36 | + fi |
| 37 | +
|
| 38 | + - name: Expect an environment transparently. |
| 39 | + runs: | |
| 40 | + set -u |
| 41 | + echo "BAZ: ${BAZ}" |
| 42 | + if [[ "${BAZ}" != "baz" ]]; then |
| 43 | + echo "Expected BAZ=baz, got BAZ=${FOO}" |
| 44 | + exit 1 |
| 45 | + fi |
| 46 | +
|
| 47 | + - name: Inject an environment to the parent pipeline. |
| 48 | + needs: |
| 49 | + environment: |
| 50 | + FOO: "bar" |
| 51 | + BAZ: "baz" |
| 52 | + |
| 53 | +test: |
| 54 | + environment: |
| 55 | + contents: |
| 56 | + packages: |
| 57 | + - busybox |
| 58 | + keyring: |
| 59 | + - https://packages.wolfi.dev/os/wolfi-signing.rsa.pub |
| 60 | + - local-melange.rsa.pub |
| 61 | + repositories: |
| 62 | + - https://packages.wolfi.dev/os |
| 63 | + - packages |
| 64 | + pipeline: |
| 65 | + - name: Expect an environment transparently. |
| 66 | + environment: |
| 67 | + FOO: "foo" |
| 68 | + runs: | |
| 69 | + set -u |
| 70 | + echo "FOO: ${FOO}" |
| 71 | + if [[ "${FOO}" != "foo" ]]; then |
| 72 | + echo "Expected FOO=foo, got FOO=${FOO}" |
| 73 | + exit 1 |
| 74 | + fi |
| 75 | + - name: Expect an environment transparently. |
| 76 | + runs: | |
| 77 | + set -u |
| 78 | + echo "BAZ: ${BAZ}" |
| 79 | + if [[ "${BAZ}" != "baz" ]]; then |
| 80 | + echo "Expected BAZ=baz, got BAZ=${FOO}" |
| 81 | + exit 1 |
| 82 | + fi |
| 83 | + - name: Inject an environment to the parent pipeline. |
| 84 | + needs: |
| 85 | + environment: |
| 86 | + FOO: "bar" |
| 87 | + BAZ: "baz" |
0 commit comments