Skip to content

String.replaceAll when used with a regex as the argument requires the… #677

String.replaceAll when used with a regex as the argument requires the…

String.replaceAll when used with a regex as the argument requires the… #677

name: Push Heimdall Lite to Docker Hub on every merge to master and tag as latest
on:
push:
branches: [master]
permissions:
contents: read
jobs:
docker:
runs-on: ubuntu-24.04
steps:
- name: Checkout the Heimdall Repository
uses: actions/checkout@v5
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push the container image to Dockerhub
id: docker_build
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.lite
push: true
platforms: linux/amd64
tags: mitre/heimdall-lite:latest,mitre/heimdall-lite:${{ github.sha }}
- name: Get Docker SHA since the Iron Bank release requires us to specify the exact resources we need them to pull into the environment
shell: bash
id: get-docker-sha
run: |
MAX_RETRIES=5
RETRY_DELAY=0.5 # in seconds
RETRY_COUNT=0
SUCCESS=false
while [ "$RETRY_COUNT" -lt "$MAX_RETRIES" ]; do
if docker pull mitre/heimdall-lite:${{ github.sha }}; then
SUCCESS=true
break
else
RETRY_COUNT="$((RETRY_COUNT + 1))"
echo "Retry $RETRY_COUNT/$MAX_RETRIES: Docker pull failed. Retrying in $RETRY_DELAY seconds..."
sleep "$RETRY_DELAY"
fi
done
if [ "$SUCCESS" = true ]; then
echo "DOCKER_SHA=$(docker inspect --format='{{index .RepoDigests 0}}' mitre/heimdall-lite:${{ github.sha }} | cut -d '@' -f 2)" >> $GITHUB_ENV
else
echo "Docker pull failed after $MAX_RETRIES attempts."
exit 1
fi
- name: Upgrade Iron Bank
uses: mitre/ironbank_release_action@v1
with:
name: Heimdall-Lite
version: ${{ github.sha }}
ironbank_pat: ${{ secrets.SAF_IRONBANK_REPO1_PAT }}
ironbank_username: ${{ secrets.SAF_IRONBANK_REPO1_USERNAME }}
ironbank_project_id: 17077
ironbank_project_clone_url: repo1.dso.mil/dsop/mitre/security-automation-framework/heimdall-lite-mainline.git
git_commit_author_name: "Automated Heimdall Release"
git_commit_author_email: "saf@mitre.org"
update_commands: |
yq e -i '.args.HEIMDALL_VERSION=\"${{ github.sha }}\" | .tags[0]=\"${{ github.sha }}\" | .labels.\"org.opencontainers.image.version\"=\"${{ github.sha }}\" | .resources[0].tag=\"mitre/heimdall-lite:${{ github.sha }}\" | .resources[0].url=\"docker://docker.io/mitre/heimdall-lite@${{ env.DOCKER_SHA }}\"' hardening_manifest.yaml
sed -i s/HEIMDALL_VERSION=\.\*/HEIMDALL_VERSION=${{ github.sha }}/ Dockerfile