Build Docker Images #77
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: Build Docker Images | |
on: | |
workflow_run: | |
workflows: ["Pre-build checks"] | |
types: | |
- completed | |
permissions: | |
checks: write | |
contents: read | |
jobs: | |
build: | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
script: [ 'build-base-k8s-jenkins-agent.sh', 'build-base-k8s-jenkins-coverage-agent.sh', 'build-base-swarm-jenkins-agent.sh', 'build-base-swarm-jenkins-coverage-agent.sh', 'build-edt-swarm-agent.sh', 'build-edt-k8s-agent.sh', 'build-oscript-k8s-agent.sh', 'build-oscript-swarm-agent.sh', 'build-server.sh' ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
repository: ${{ github.event.workflow_run.head_repository.full_name }} | |
ref: ${{ github.event.workflow_run.head_sha }} | |
- name: Create Check Run (Started) | |
uses: actions/github-script@v7 | |
id: create_check_run | |
with: | |
script: | | |
const { data: checkRun } = await github.rest.checks.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: 'Build Workflow - ${{ matrix.script }}', | |
head_sha: '${{ github.event.workflow_run.head_sha }}', | |
status: 'in_progress', | |
details_url: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}', | |
output: { | |
title: 'Build Started', | |
summary: 'Build has started.' | |
} | |
}); | |
core.setOutput('check_run_id', checkRun.id); | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Docker images | |
env: | |
DOCKER_REGISTRY_URL: 'localhost:5000' | |
DOCKER_LOGIN: "" | |
DOCKER_PASSWORD: "" | |
ONEC_USERNAME: ${{ secrets.ONEC_USERNAME}} | |
ONEC_PASSWORD: ${{ secrets.ONEC_PASSWORD}} | |
ONEC_VERSION: '8.3.24.1624' | |
EDT_VERSION: '2023.3.6' | |
COVERAGE41C_VERSION: '2.7.3' | |
DOCKER_SYSTEM_PRUNE: 'false' | |
run: | | |
docker system prune -af | |
docker run -d -p 5000:5000 --name registry registry:2 | |
./${{ matrix.script }} | |
- name: Update PR Check Status (Completed) | |
if: always() | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const conclusion = '${{ job.status }}' === 'success' ? 'success' : 'failure'; | |
await github.rest.checks.update({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
check_run_id: ${{ steps.create_check_run.outputs.check_run_id }}, | |
status: 'completed', | |
conclusion, | |
completed_at: new Date().toISOString(), | |
output: { | |
title: 'Build ' + (conclusion === 'success' ? 'Succeeded' : 'Failed'), | |
summary: `Workflow for script '${{ matrix.script }}' completed with conclusion: ${conclusion}` | |
} | |
}); |