Merge tag '5.2.240907' into develop #80
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image CI | |
on: | |
push: | |
branches: [ "develop" ] | |
env: | |
FS_DOWNLOAD_SERVER: ${{ secrets.FS_DOWNLOAD_SERVER }} | |
FS_DOWNLOAD_SERVER_USERNAME: ${{ secrets.FS_DOWNLOAD_SERVER_USERNAME }} | |
FS_DOWNLOAD_SERVER_PASSWORD: ${{ secrets.FS_DOWNLOAD_SERVER_PASSWORD }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Create variables file | |
run: grep 'ARG IMAGE_VERSION=' -m1 jdk17/Dockerfile | sed 's/ARG IMAGE_VERSION="\(.*\)"/IMAGE_VERSION=\1/' >> $GITHUB_ENV && grep 'ARG IMAGE_VERSION_SHORT=' -m1 jdk17/Dockerfile | sed 's/ARG IMAGE_VERSION_SHORT="\(.*\)"/IMAGE_VERSION_SHORT=\1/' >> $GITHUB_ENV | |
- name: install chef | |
uses: actionshub/chef-install@main | |
with: | |
channel: stable | |
project: inspec | |
version: 5.22.58 | |
- name: Build the Docker image | |
run: docker build . --file jdk17/Dockerfile --build-arg FS_DOWNLOAD_SERVER=${{ env.FS_DOWNLOAD_SERVER }} --build-arg FS_DOWNLOAD_SERVER_USERNAME=${{ env.FS_DOWNLOAD_SERVER_USERNAME }} --build-arg FS_DOWNLOAD_SERVER_PASSWORD=${{ env.FS_DOWNLOAD_SERVER_PASSWORD }} --build-arg IMAGE_CREATED=$(date +%FT%T%Z) --tag my-image-name:jdk17 | |
- name: Start container for test | |
run: container_id=$(docker run -d my-image-name:jdk17) && while [[ "$(docker inspect -f '{{.State.Health.Status}}' $container_id)" != "healthy" ]]; do sleep 1; done && echo "Container $container_id is now healthy!" && echo "CONTAINER_ID=$container_id" >> $GITHUB_ENV | |
- name: Run inSpec Tests | |
run: inspec exec ./inspec-tests --input firstspirit_version=${{ env.IMAGE_VERSION }} firstspirit_version_short=${{ env.IMAGE_VERSION_SHORT }} -t docker://${{ env.CONTAINER_ID }} --chef-license=accept --reporter junit2:junit-test.xml | |
- name: Clean up container | |
run: docker stop ${{ env.CONTAINER_ID }} && docker rm ${{ env.CONTAINER_ID }} | |
- name: Publish Test Report | |
uses: mikepenz/action-junit-report@v3 | |
if: success() || failure() | |
with: | |
report_paths: 'junit-test.xml' | |