Skip to content

Commit 85ef49f

Browse files
refactor: add annotations to insights configmaps (#435)
* refactor: add annotations to insights configmaps * chore: Update legacy/scripts/exec-generate-insights-configmap.sh Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent 5f38fb1 commit 85ef49f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

legacy/scripts/exec-generate-insights-configmap.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@ processImageInspect() {
3636
create configmap ${IMAGE_INSPECT_CONFIGMAP} \
3737
--from-file=${IMAGE_INSPECT_OUTPUT_FILE}
3838
fi
39+
if [[ "$BUILD_TYPE" == "pullrequest" ]]; then
40+
kubectl -n ${NAMESPACE} \
41+
annotate configmap ${IMAGE_INSPECT_CONFIGMAP} \
42+
lagoon.sh/branch=${PR_NUMBER} \
43+
lagoon.sh/prHeadBranch=${PR_HEAD_BRANCH} \
44+
lagoon.sh/prBaseBranch=${PR_BASE_BRANCH}
45+
else
46+
kubectl -n ${NAMESPACE} \
47+
annotate configmap ${IMAGE_INSPECT_CONFIGMAP} \
48+
lagoon.sh/branch=${BRANCH}
49+
fi
3950
kubectl \
4051
-n ${NAMESPACE} \
4152
label configmap ${IMAGE_INSPECT_CONFIGMAP} \
@@ -46,6 +57,7 @@ processImageInspect() {
4657
lagoon.sh/environment=${ENVIRONMENT} \
4758
lagoon.sh/service=${IMAGE_NAME} \
4859
lagoon.sh/environmentType=${ENVIRONMENT_TYPE} \
60+
lagoon.sh/buildType=${BUILD_TYPE} \
4961
insights.lagoon.sh/type=inspect
5062
}
5163

@@ -84,6 +96,17 @@ processSbom() {
8496
create configmap ${SBOM_CONFIGMAP} \
8597
--from-file=${SBOM_OUTPUT_FILE}
8698
fi
99+
if [[ "$BUILD_TYPE" == "pullrequest" ]]; then
100+
kubectl -n ${NAMESPACE} \
101+
annotate configmap ${SBOM_CONFIGMAP} \
102+
lagoon.sh/branch=${PR_NUMBER} \
103+
lagoon.sh/prHeadBranch=${PR_HEAD_BRANCH} \
104+
lagoon.sh/prBaseBranch=${PR_BASE_BRANCH}
105+
else
106+
kubectl -n ${NAMESPACE} \
107+
annotate configmap ${SBOM_CONFIGMAP} \
108+
lagoon.sh/branch=${BRANCH}
109+
fi
87110
kubectl \
88111
-n ${NAMESPACE} \
89112
label configmap ${SBOM_CONFIGMAP} \
@@ -94,6 +117,7 @@ processSbom() {
94117
lagoon.sh/environment=${ENVIRONMENT} \
95118
lagoon.sh/service=${IMAGE_NAME} \
96119
lagoon.sh/environmentType=${ENVIRONMENT_TYPE} \
120+
lagoon.sh/buildType=${BUILD_TYPE} \
97121
insights.lagoon.sh/type=sbom
98122
fi
99123
}

0 commit comments

Comments
 (0)