Skip to content

Commit 41d8205

Browse files
committed
feat: add STIG compliance adjustments to hack/release files
Signed-off-by: Michael Zeevi <[email protected]>
1 parent 92fdb46 commit 41d8205

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

.github/workflows/release.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,9 @@ jobs:
289289
done
290290
291291
# Special handling for Mofed component (update registry only, not version, for all releases)
292-
echo "Updating Mofed component registry for release"
293-
yq -i '.Mofed.repository = "${{ env.DOCKER_REGISTRY_MANAGED_COMPONENTS }}"' hack/release.yaml
292+
echo "Updating Mofed components registry for release"
293+
yq -i '.Mofed.repository = "${{ env.DOCKER_REGISTRY_MANAGED_COMPONENTS }}"' hack/release.yaml
294+
yq -i '.MofedStig.repository = "${{ env.DOCKER_REGISTRY_MANAGED_COMPONENTS }}"' hack/release.yaml
294295
295296
# Update chart versions
296297
yq -i '.version = "${{ env.CHART_VERSION }}"' deployment/network-operator/Chart.yaml
@@ -309,4 +310,4 @@ jobs:
309310
--base $BASE_BRANCH \
310311
--head $(git branch --show-current) \
311312
--title "cicd: release Network Operator $APP_VERSION" \
312-
--body "Created by the [*${{ github.job }}* job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})."
313+
--body "Created by the [*${{ github.job }}* job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})."

hack/release.go

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ type Release struct {
6767
SriovCni *ReleaseImageSpec
6868
SriovIbCni *ReleaseImageSpec
6969
Mofed *ReleaseImageSpec
70+
MofedStig *ReleaseImageSpec
7071
RdmaSharedDevicePlugin *ReleaseImageSpec
7172
SriovDevicePlugin *ReleaseImageSpec
7273
IbKubernetes *ReleaseImageSpec
@@ -185,19 +186,38 @@ func docaDriverTagsCheck(release *Release, docaDriverMatrix *string) {
185186
fmt.Printf("Error: %v\n", err)
186187
os.Exit(1)
187188
}
188-
if err := validateTags(config, tags, release.Mofed.Version); err != nil {
189+
tagsStig, err := listTags(release.MofedStig.Repository, release.MofedStig.Image)
190+
if err != nil {
191+
fmt.Printf("Error: %v\n", err)
192+
os.Exit(1)
193+
}
194+
// validate all non-STIG compliant tags
195+
if err := validateTags(config, tags, release.Mofed.Version, func(os string) bool {
196+
return !strings.HasSuffix(os, "-stig")
197+
}); err != nil {
198+
fmt.Printf("Error: %v\n", err)
199+
os.Exit(1)
200+
}
201+
// validate all STIG compliant tags
202+
if err := validateTags(config, tagsStig, release.MofedStig.Version, func(os string) bool {
203+
return strings.HasSuffix(os, "-stig")
204+
}); err != nil {
189205
fmt.Printf("Error: %v\n", err)
190206
os.Exit(1)
191207
}
192208
}
193209

194-
func validateTags(config DocaDriverMatrix, tags []string, version string) error {
210+
func validateTags(config DocaDriverMatrix, tags []string, version string,
211+
shouldValidateOsFunction func(string) bool) error {
195212
// Build expected OS-arch combinations
196213
expectedCombinations := make(map[string]struct{})
197214
for _, entry := range config.DynamicallyCompiled {
198215
for _, arch := range entry.Arches {
199-
key := fmt.Sprintf("%s-%s", entry.OS, arch)
200-
expectedCombinations[key] = struct{}{}
216+
shouldValidateCurrentEntry := shouldValidateOsFunction(entry.OS)
217+
if shouldValidateCurrentEntry {
218+
key := fmt.Sprintf("%s-%s", entry.OS, arch)
219+
expectedCombinations[key] = struct{}{}
220+
}
201221
}
202222
}
203223

hack/release.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ Mofed:
3838
image: doca-driver
3939
repository: nvcr.io/nvstaging/mellanox
4040
version: doca3.2.0-25.10-1.0.0.0-0
41+
MofedStig:
42+
image: doca-driver-stig
43+
repository: nvcr.io/nvstaging/mellanox
44+
version: doca3.2.0-25.10-1.0.0.0-0
4145
RdmaSharedDevicePlugin:
4246
image: k8s-rdma-shared-dev-plugin
4347
repository: nvcr.io/nvstaging/mellanox

0 commit comments

Comments
 (0)