Skip to content

build_nginx

build_nginx #238

name: "Build (6 of 6) Nginx w/static files"
on:
repository_dispatch:
types:
- build_nginx
- build_engage_error
- build_generic_error
env:
VERSION_STR: ${{ github.event.client_payload.version.str }}
VER_NUM: ${{ github.event.client_payload.version.int }}
FROM_LAYER: ${{ github.event.client_payload.image.layer }}
jobs:
build_result:
name: "Build Layer 5 Result [#${{ github.event.client_payload.run_number }}]"
runs-on: ubuntu-latest
env:
RUN_URL: "[Run #${{ github.event.client_payload.run_number }}](${{ github.event.client_payload.run_url }})"
steps:
- name: "Display Error Msg"
if: github.event.client_payload.error_msg != ''
run: |-
echo -e "::error::${RUN_URL}%0A${{ github.event.client_payload.error_msg }}"
exit 1
- name: "Display Success Msg"
if: github.event.client_payload.build_msg != ''
run: |-
echo -e "::notice::${RUN_URL}%0A${{ github.event.client_payload.build_msg }}"
#endjob build_result
build_cfg:
needs: [build_result]
runs-on: ubuntu-latest
environment: default
env:
ALT_TAG: ${{ github.event.client_payload.version.alt }}
outputs:
DOCKERFILE2USE: "docker/nginx/nginx.dockerfile"
IMAGE_NAME: ${{ github.event.client_payload.image.name }}
IMAGE_TAG: "nginx-${{ github.event.client_payload.version.str }}"
ALT_TAG: ${{ steps.config_step.outputs.ALT_TAG }}
steps:
- name: "Determine alt tags, if any"
id: config_step
run: |-
if [[ -n "${{ github.event.client_payload.version.alt }}" ]]; then
ALT_TAG=",nginx-${ALT_TAG#,}"
echo "ALT_TAG=${ALT_TAG}" >> $GITHUB_OUTPUT
fi
#endjob build_cfg
trigger-build:
runs-on: ubuntu-latest
needs: [build_cfg]
environment: default
steps:
- name: "Trigger Container Build For Nginx"
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.CI_WEBHOOK_TOKEN }}
repository: istresearch/ci-docker
event-type: build-repo
client-payload: |-
{
"repo": {
"name": "${{ github.repository }}",
"ref_type": "${{ github.event.client_payload.repo.ref_type }}",
"ref_name": "${{ github.event.client_payload.repo.ref_name }}"
},
"image": {
"dockerfile": "${{ needs.build_cfg.outputs.DOCKERFILE2USE }}",
"arch_allowed": "${{ github.event.client_payload.image.arch_allowed }}",
"name": "${{ needs.build_cfg.outputs.IMAGE_NAME }}",
"tag": "${{ needs.build_cfg.outputs.IMAGE_TAG }}${{ needs.build_cfg.outputs.ALT_TAG }}",
"build_args": [
"STATICFILES_FROM_IMAGE=${{ env.FROM_LAYER }}"
]
},
"deployment": {
"deploy_flag": "${{ github.event.client_payload.deploy }}",
"k8s": [ {
"project": "pulse-engage-nginx",
"container": "nginx",
"image": "${{ needs.build_cfg.outputs.IMAGE_NAME }}:${{ needs.build_cfg.outputs.IMAGE_TAG }}"
} ]
},
"callback": {
"repository": "${{ github.repository }}",
"event_type": "build_nginx_success",
"error_type": "build_nginx_error"
}
}
#endjob trigger-build