Skip to content

Verify Build

Verify Build #836

Workflow file for this run

# This workflow will perform a test whenever there
# is some change in code done to ensure that the
# changes are not buggy and we are getting desired output.
name: Verify Build
on:
push:
workflow_dispatch:
pull_request:
schedule:
- cron: '0 0 * * *' # every day at midnight
env:
TEST_REPO: helloworld
IMAGE_NAME: hello-world
TAGS: latest v1
jobs:
test-s2i-job:
runs-on: ubuntu-latest
# This will install latest version of s2i and
# to build the image and using Docker we will
# run the image to verify the build.
name: Install S2I and build image
steps:
# Checkout S2I action github repository
- name: Checkout s2i-build action
uses: actions/checkout@v4
with:
path: 's2i-build'
# Checkout hello-world repository for testing
- name: Checkout application
uses: actions/checkout@v4
with:
repository: 'go-training/helloworld'
path: ${{ env.TEST_REPO }}
# Install s2i cli for future steps
- name: Install S2i
uses: redhat-actions/openshift-tools-installer@v1
with:
source: github
github_pat: ${{ github.token }}
s2i: "latest"
# Build container image
- name: Build
id: build_image
uses: ./s2i-build/
with:
path_context: './${{ env.TEST_REPO }}'
builder_image: 'centos/go-toolset-7-centos7'
image: ${{ env.IMAGE_NAME }}
tags: ${{ env.TAGS }}
- name: Echo Outputs
run: |
echo "Image: ${{ steps.build_image.outputs.image }}"
echo "Tags: ${{ steps.build_image.outputs.tags }}"
# Run image to verify the build
- name: Run image
run: docker run ${{ env.IMAGE_NAME}}:latest