Skip to content

custom-ci-pipeline

custom-ci-pipeline #2

# This is a sample workflow to demonstrate a CI pipeline with onboarding of a new release of an offering
# to the IBM Cloud catalog.
name: custom-ci-pipeline
# Controls when the workflow will run
on:
# Triggers the workflow on the publish of a release. Its assumed that the release has an associated tag.
release:
types:
- published
workflow_dispatch:
jobs:
# This workflow contains a single job called "onboard-publish-release"
onboard-publish-release:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# run if the release tag does not contain 'test' or 'stable'
if: "!contains(github.event.release.tag_name, 'test') && !contains(github.event.release.tag_name, 'stable')"
env:
CATALOG_NAME: Demo
OFFERING_NAME: custom-deployable-arch
OFFERING_VARIATION_LABEL: BabySLZ
RESOURCE_GROUP: default
WORKLOAD_OFFERING_NAME: custom-apache
WORKLOAD_VARIATION_LABEL: Standard
EXTENSION_INSTALL_TYPE: extension
FULLSTACK_INSTALL_TYPE: fullstack
FORMAT_KIND_TERRAFORM: terraform
FORMAT_KIND_BLUEPRINT: blueprint
# Note that IBMCLOUD_API_KEY is a secret environment variable configured on the project
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access scripts, etc.
- uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name }}
- name: Install and setup IBMCLOUD Cli
env:
IBMCLOUD_API_KEY: ${{ secrets.IBMCLOUD_API_KEY }}
run: |
./.github/scripts/installCloudCli.sh
- name: Upload, validate, scan and publish custom-deployable-arch - Baby SLZ variation
env:
IBMCLOUD_API_KEY: ${{ secrets.IBMCLOUD_API_KEY }}
VERSION: ${{ github.event.release.tag_name }}
run: |
echo "--------------------------------------------------------------------"
echo "onboard version, validate, scan, publish"
echo "--------------------------------------------------------------------"
./.github/scripts/onboard_validate_publish.sh "$CATALOG_NAME" "$OFFERING_NAME" "$VERSION" "$OFFERING_VARIATION_LABEL" "$FULLSTACK_INSTALL_TYPE" "$RESOURCE_GROUP" "$FORMAT_KIND_TERRAFORM" "SCAN"
- name: Upload, validate, scan and publish custom-apache extension
env:
IBMCLOUD_API_KEY: ${{ secrets.IBMCLOUD_API_KEY }}
VERSION: ${{ github.event.release.tag_name }}
run: |
./.github/scripts/onboard_validate_publish.sh "$CATALOG_NAME" "$WORKLOAD_OFFERING_NAME" "$VERSION" "$WORKLOAD_VARIATION_LABEL" "$EXTENSION_INSTALL_TYPE" "$RESOURCE_GROUP" "$FORMAT_KIND_TERRAFORM" "SCAN"
- name: Cleanup deployed resources
env:
IBMCLOUD_API_KEY: ${{ secrets.IBMCLOUD_API_KEY }}
VERSION: ${{ github.event.release.tag_name }}
run: |
echo "--------------------------------------------------------------------"
echo "cleanup validation resources"
echo "--------------------------------------------------------------------"
./.github/scripts/cleanup.sh "$CATALOG_NAME" "$WORKLOAD_OFFERING_NAME" "$VERSION" "$WORKLOAD_VARIATION_LABEL" "$EXTENSION_INSTALL_TYPE" "$FORMAT_KIND_TERRAFORM"
./.github/scripts/cleanup.sh "$CATALOG_NAME" "$OFFERING_NAME" "$VERSION" "$OFFERING_VARIATION_LABEL" "$FULLSTACK_INSTALL_TYPE" "$FORMAT_KIND_TERRAFORM"