Skip to content

Commit

Permalink
task/operator-sdk-generate-bundle: allow for supplying additional labels
Browse files Browse the repository at this point in the history
in order to comply with the required labels check, the generated
dockerfile needs to have labels amended to it. By providing an
additional file with this data, it can be appended in order to pass the
compliance check

```
❯ cat -p config/metadata/additional-labels.txt
LABEL com.redhat.component="" \
      description="" \
      distribution-scope="" \
      io.k8s.description="" \
      name="" \
      release="" \
      url="" \
      vendor="" \
      version=""
```

Signed-off-by: Brady Pratt <[email protected]>
  • Loading branch information
jbpratt authored and rcerven committed Sep 12, 2024
1 parent 5d49817 commit d42191e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 16 deletions.
1 change: 1 addition & 0 deletions task/operator-sdk-generate-bundle/0.1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Generate an OLM bundle using the operator-sdk
|extra-service-accounts|Comma-seperated list of service account names, outside of the operator's Deployment account, that have bindings to {Cluster}Roles that should be added to the CSV |""|false|
|version|Semantic version of the operator in the generated bundle||true|
|package-name|Bundle's package name||true|
|additional-labels-file|A plain text file containing additional labels to append to the generated Dockerfile |""|false|

## Workspaces
|name|description|optional|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ spec:
description: Semantic version of the operator in the generated bundle
- name: package-name
description: Bundle's package name
- name: additional-labels-file
description: >
A plain text file containing additional labels to append to the
generated Dockerfile
default: ""
workspaces:
- name: source
description: Workspace with the source code
Expand All @@ -36,19 +41,35 @@ spec:
workingDir: $(workspaces.source.path)/source
securityContext:
runAsUser: 0
args:
- generate
- bundle
- --overwrite
- --channels
- $(params.channels)
- --input-dir
- $(params.input-dir)
- --version
- $(params.version)
- --package
- $(params.package-name)
- --kustomize-dir
- $(params.kustomize-dir)
- --extra-service-accounts
- $(params.extra-service-accounts)
env:
- name: CHANNELS
value: $(params.channels)
- name: INPUT_DIR
value: $(params.input-dir)
- name: VERSION
value: $(params.version)
- name: PACKAGE_NAME
value: $(params.package-name)
- name: KUSTOMIZE_DIR
value: $(params.kustomize-dir)
- name: EXTRA_SERVICE_ACCOUNTS
value: $(params.extra-service-accounts)
- name: ADDITIONAL_LABELS_FILE
value: $(params.additional-labels-file)
script: |
#!/usr/bin/env bash
set -xe
operator-sdk generate bundle \
--overwrite \
--channels "${CHANNELS}" \
--input-dir "${INPUT_DIR}" \
--version "${VERSION}" \
--package "${PACKAGE_NAME}" \
--kustomize-dir "${KUSTOMIZE_DIR}" \
--extra-service-accounts "${EXTRA_SERVICE_ACCOUNTS}"
if [ -f "${ADDITIONAL_LABELS_FILE}" ]; then
cat "${ADDITIONAL_LABELS_FILE}" >> bundle.Dockerfile
fi

0 comments on commit d42191e

Please sign in to comment.