Skip to content

build_layer_app

build_layer_app #241

name: "Build (3 of 6) App Layer"
on:
repository_dispatch:
types: [build_layer_app, build_layer_lib_error]
env:
IMAGE_STAGE: pyapp
DOCKERFILE2USE: docker/dfstage-pyapp.dockerfile
FROM_LAYER: ${{ github.event.client_payload.layer }}
FROM_LAYER_TAG: ${{ github.event.client_payload.layer_tag }}
jobs:
build_result:
name: "Build Lib Layer 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
outputs:
IMAGE_NAME: ${{ steps.config_step.outputs.IMAGE_NAME }}
IMAGE_TAG: ${{ steps.config_step.outputs.IMAGE_TAG }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.client_payload.repo.ref_name }}
- name: "Determine Tag To Use"
id: config_step
shell: bash
env:
REF_NAME: "${{ github.event.client_payload.repo.ref_name }}"
run: |-
IMAGE_NAME=${{ github.repository_owner }}/p4-engage
VERSION_STR=${{ github.event.client_payload.version.str }}
IMAGE_TAG="${IMAGE_STAGE}-${VERSION_STR}"
echo "::notice::Layer3: ${IMAGE_NAME}:${IMAGE_TAG}"
echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_OUTPUT
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_OUTPUT
#endjob build_cfg
trigger-build:
runs-on: ubuntu-latest
needs: [build_cfg]
environment: default
steps:
- name: Trigger Container Build
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": "${{ env.DOCKERFILE2USE }}",
"arch_allowed": "${{ github.event.client_payload.arch_allowed }}",
"name": "${{ needs.build_cfg.outputs.IMAGE_NAME }}",
"tag": "${{ needs.build_cfg.outputs.IMAGE_TAG }}",
"build_args": [
"FROM_STAGE=${{ env.FROM_LAYER }}",
"VERSION_CI=${{ github.event.client_payload.version.int }}",
"VERSION_TAG=${{ github.event.client_payload.version.str }}"
]
},
"deployment": {
"deploy_flag": "0"
},
"callback": {
"repository": "${{ github.repository }}",
"event_type": "build_layer_files",
"error_type": "build_layer_app_error",
"payload": {
"repo": {
"ref_type": "${{ github.event.client_payload.repo.ref_type }}",
"ref_name": "${{ github.event.client_payload.repo.ref_name }}"
},
"layer": "${{ needs.build_cfg.outputs.IMAGE_NAME }}:${{ needs.build_cfg.outputs.IMAGE_TAG }}",
"arch_allowed": "${{ github.event.client_payload.arch_allowed }}",
"version": {
"str": "${{ github.event.client_payload.version.str }}",
"int": "${{ github.event.client_payload.version.int }}",
"kind": "${{ github.event.client_payload.version.kind }}",
"alt": "${{ github.event.client_payload.version.alt }}"
}
}
}
}
#endjob trigger-build