Skip to content

Commit

Permalink
Move container build to gh runner
Browse files Browse the repository at this point in the history
Signed-off-by: Huy Mai <[email protected]>
  • Loading branch information
mquhuy committed Aug 6, 2024
1 parent a8d421e commit 32e3a26
Showing 1 changed file with 60 additions and 35 deletions.
95 changes: 60 additions & 35 deletions .github/workflows/build-images-action.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: build-images-action

on:
push:
branches:
- 'main'
- 'release-*'
tags:
- 'v*'
pull_request
# push:
# branches:
# - 'main'
# - 'release-*'
# tags:
# - 'v*'

permissions: {}

Expand All @@ -20,37 +21,61 @@ jobs:

if: github.repository == 'metal3-io/baremetal-operator'
steps:

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ github.ref }}

- name: Get current date
id: date
run: echo "current_date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT

- name: Get image tags
id: image_tags
run: |
BASE_TAG=`echo "${{ github.ref_name }}" | sed 's/\//_/'`
IMAGE_TAGS="${BASE_TAG} ${BASE_TAG}_${{ steps.date.outputs.current_date }}_${{ github.sha }}"
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
IMAGE_TAGS="${IMAGE_TAGS} latest"
fi
echo "IMAGE_TAGS=${IMAGE_TAGS}" >> $GITHUB_ENV
- name: Echo the image tags
run: echo "${IMAGE_TAGS}"

- name: build bmo image
uses: toptal/jenkins-job-trigger-action@137fff703dd260b52b53d3ba1960396415abc568 # 1.0.2
uses: philips-software/docker-ci-scripts@d0045b844f08b0dcb4c62bd4acf6c36877404dae # v5.1.0
with:
jenkins_url: "https://jenkins.nordix.org/"
jenkins_user: "[email protected]"
jenkins_token: ${{ secrets.JENKINS_TOKEN }}
job_name: "metal3_baremetal-operator_container_image_building"
job_params: |
{
"BUILD_CONTAINER_IMAGE_GIT_REFERENCE": "${{ github.ref }}"
}
job_timeout: "1000"
dockerfile: "."
image-name: "baremetal-operator"
tags: ${{ env.IMAGE_TAGS }}
env:
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_TOKEN: "${{ secrets.REGISTRY_TOKEN }}"
REGISTRY_URL: quay.io/metal3-io
GITHUB_ORGANIZATION: metal3-io
BUILD_CONTAINER_IMAGE_GIT_REFERENCE": "${{ github.ref }}"

- name: build keepalived image
uses: toptal/jenkins-job-trigger-action@137fff703dd260b52b53d3ba1960396415abc568 # 1.0.2
uses: philips-software/docker-ci-scripts@d0045b844f08b0dcb4c62bd4acf6c36877404dae # v5.1.0
with:
jenkins_url: "https://jenkins.nordix.org/"
jenkins_user: "[email protected]"
jenkins_token: ${{ secrets.JENKINS_TOKEN }}
job_name: "metal3_keepalived_container_image_building"
job_params: |
{
"BUILD_CONTAINER_IMAGE_GIT_REFERENCE": "${{ github.ref }}"
}
job_timeout: "1000"
- name: Slack Notification on Failure
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@4e5fb42d249be6a45a298f3c9543b111b02f7907 # 2.3.0
dockerfile: resources/keepalived-docker/Dockerfile
image-name: keepalived
tags: ${{ env.IMAGE_TAGS }}
env:
SLACK_TITLE: 'GitHub Action Failed in ${{ github.repository }}'
SLACK_COLOR: '#FF0000'
SLACK_MESSAGE: 'The GitHub Action workflow failed for baremetal operator image build.'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: metal3-github-actions-notify
SLACK_USERNAME: metal3-github-actions-notify
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_TOKEN: "${{ secrets.REGISTRY_TOKEN }}"
REGISTRY_URL: quay.io/metal3-io
GITHUB_ORGANIZATION: metal3-io
BUILD_CONTAINER_IMAGE_GIT_REFERENCE": "${{ github.ref }}"

# - name: Slack Notification on Failure
# if: ${{ failure() }}
# uses: rtCamp/action-slack-notify@4e5fb42d249be6a45a298f3c9543b111b02f7907 # 2.3.0
# env:
# SLACK_TITLE: 'GitHub Action Failed in ${{ github.repository }}'
# SLACK_COLOR: '#FF0000'
# SLACK_MESSAGE: 'The GitHub Action workflow failed for baremetal operator image build.'
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
# SLACK_CHANNEL: metal3-github-actions-notify
# SLACK_USERNAME: metal3-github-actions-notify

0 comments on commit 32e3a26

Please sign in to comment.