Skip to content

Commit

Permalink
Updates ubi hardening extras to build ubi8.9.
Browse files Browse the repository at this point in the history
  • Loading branch information
mw-vmaffet authored and Prabhakar Kumar committed Dec 18, 2023
1 parent 3c0c29d commit 8c4917f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/build-and-publish-ubi-hardening-extras.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:

env:
BASE_IMAGE: almalinux-base
OS_TAG: ubi8.9

jobs:
build-base-image:
Expand Down Expand Up @@ -106,21 +107,19 @@ jobs:
id: pull_latest
continue-on-error: true
run: |
docker pull ${{ env.IMAGE_NAME }}:latest
docker pull ${{ env.IMAGE_NAME }}:${{ env.OS_TAG }}
- name: Extract signature and version from latest Docker image
id: extract
run: |
# Extract signature and version files from latest docker image if pull was succesful.
if [[ ${{ steps.pull_latest.outcome }} == 'success' ]]; then
VERSION=$(bash ./ubi-hardening-extras/workflow/extract_metadata.sh ${{ env.IMAGE_NAME }}:latest)
VERSION=$(bash ./ubi-hardening-extras/workflow/extract_metadata.sh ${{ env.IMAGE_NAME }}:${{ env.OS_TAG }})
echo -e "${{ env.GREEN }}>> Found ${{ env.IMAGE_NAME }} version ${VERSION}.${{ env.NC }}"
NEXT_VERSION=$(bash ./ubi-hardening-extras/workflow/increment_version.sh ${VERSION})
else
echo -e "${{ env.RED }}>> Image ${{ env.IMAGE_NAME }} does not exist.${{ env.NC }}"
NEXT_VERSION="v1.0"
fi
echo "next_version=${NEXT_VERSION}" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -148,8 +147,8 @@ jobs:
BASE_IMAGE=${{ env.BASE_IMAGE }}
VERSION=${{ steps.extract.outputs.next_version }}
tags: |
${{ env.IMAGE_NAME }}:latest
${{ env.IMAGE_NAME }}:${{ steps.extract.outputs.next_version }}
${{ env.IMAGE_NAME }}:${{ env.OS_TAG }}
${{ env.IMAGE_NAME }}:${{ steps.extract.outputs.next_version }}-${{ env.OS_TAG }}
- name: Set up Python 3
if: ${{ steps.check.outputs.is_identical != '0' }}
Expand All @@ -167,8 +166,10 @@ jobs:
- name: Test new UBI package Docker image
if: ${{ steps.check.outputs.is_identical != '0' }}
working-directory: ubi-hardening-extras/tests
env:
IMAGE_UNDER_TEST: ${{ env.IMAGE_NAME }}:${{ env.OS_TAG }}
run: python -m unittest ${{ matrix.package }}/*.py

# Push the package Docker image built in the "Build Docker image for UBI packages" step to GHCR
# (since we now know if something has changed).
- name: Push to GitHub Container Registry if package has changed
Expand Down
2 changes: 1 addition & 1 deletion ubi-hardening-extras/almalinux-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright 2023 The MathWorks, Inc.
ARG BASE_IMAGE=almalinux
ARG BASE_TAG=8.8
ARG BASE_TAG=8.9

FROM ${BASE_IMAGE}:${BASE_TAG}

Expand Down
2 changes: 1 addition & 1 deletion ubi-hardening-extras/tests/utils/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

ARG BASE_REGISTRY=redhat
ARG BASE_IMAGE=ubi8
ARG BASE_TAG=8.8
ARG BASE_TAG=8.9
ARG IMAGE_UNDER_TEST

FROM ${IMAGE_UNDER_TEST} AS image-under-test
Expand Down
2 changes: 1 addition & 1 deletion ubi-hardening-extras/tests/utils/Dockerfile.novnc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

ARG BASE_REGISTRY=redhat
ARG BASE_IMAGE=ubi8
ARG BASE_TAG=8.8
ARG BASE_TAG=8.9
ARG IMAGE_UNDER_TEST=novnc

FROM ${IMAGE_UNDER_TEST} AS image-under-test
Expand Down
2 changes: 1 addition & 1 deletion ubi-hardening-extras/tests/utils/basetest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TestCase(unittest.TestCase):
"""Base test class"""

# default parameters (can be overridden in derived test classes)
buildargs = {"IMAGE_UNDER_TEST": os.getenv("IMAGE_NAME")}
buildargs = {"IMAGE_UNDER_TEST": os.getenv("IMAGE_UNDER_TEST")}
dockerfile = "Dockerfile"

@classmethod
Expand Down

0 comments on commit 8c4917f

Please sign in to comment.