CI #4816
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| schedule: | |
| - cron: "35 */6 * * *" | |
| jobs: | |
| configure: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - name: Checkout to repository | |
| uses: actions/checkout@v4 | |
| - name: Set matrix data | |
| id: set-matrix | |
| run: echo "matrix=$(jq -c . < ./distro_versions.json)" >> $GITHUB_OUTPUT | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: configure | |
| strategy: | |
| # allow pushing successfully built images anyway | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.configure.outputs.matrix) }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: "Set up RPM client User-Agent for images" | |
| run: | | |
| sed -i "s@XXXXXXXXXX@${{ secrets.RPMBUILDER_UA }}@g" assets/transient/fix-repos.sh | |
| sed -i "s@XXXXXXXXXX@${{ secrets.RPMBUILDER_UA }}@g" assets/transient/user-agent.py | |
| - name: Generate Dockerfile | |
| run: ./crypt-keeper.sh generate ${{ matrix.os }} ${{ matrix.version }} | |
| - name: Log in to Docker Hub | |
| run: docker login -u="${{ secrets.DOCKER_USER }}" -p="${{ secrets.DOCKER_PASS }}" | |
| - name: Build And Push Docker Image with Retry | |
| run: | | |
| MAX_ATTEMPTS=10 | |
| for attempt in $(seq 1 $MAX_ATTEMPTS); do | |
| echo "Attempt $attempt of $MAX_ATTEMPTS: Building Docker image..." | |
| ./crypt-keeper.sh build ${{ matrix.os }} ${{ matrix.version }} && break | |
| EXIT_CODE=$? | |
| echo "Attempt $attempt failed with exit code $EXIT_CODE." | |
| if [ "$attempt" -lt "$MAX_ATTEMPTS" ]; then | |
| echo "Retrying in 30 seconds..." | |
| sleep 30 | |
| else | |
| echo "All $MAX_ATTEMPTS attempts failed." | |
| exit $EXIT_CODE | |
| fi | |
| done | |
| - name: Test RPM Build using the image | |
| run: ./crypt-keeper.sh test ${{ matrix.os }} ${{ matrix.version }} | |
| - name: Push to Docker Hub | |
| run: ./crypt-keeper.sh push ${{ matrix.os }} ${{ matrix.version }} |