Update pr.yml #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# name: Pentaho release workflow | |
# on: | |
# workflow_call: | |
# inputs: | |
# release_version: | |
# description: "" | |
# required: true | |
# type: string | |
# arti_host: | |
# required: false | |
# type: string | |
# default: https://one.hitachivantara.com | |
# description: "Artifactory's Host name" | |
# create_release_bundle: | |
# type: boolean | |
# default: true | |
# description: "Create Release Bundle." | |
# manifest_file_path: | |
# required: false | |
# type: string | |
# default: ".github/artifacts-manifest.yaml" | |
# jf_cli_rt_name: | |
# required: false | |
# type: string | |
# default: artifactory | |
# ref: | |
# required: false | |
# default: '' | |
# type: string | |
# description: "ref to which the repo calls this workflow" | |
# dry_run: | |
# type: boolean | |
# default: true | |
# description: "Dry run. No real changes should occur." | |
# promote_artifacts: | |
# type: boolean | |
# default: true | |
# description: "Promote artifacts in Artifactory." | |
# logging_level: | |
# type: string | |
# default: INFO | |
# required: false | |
# description: "Sets the logging level to get more detailed info." | |
# release_bundle_name: | |
# description: "Release Bundle Name" | |
# required: false | |
# type: string | |
# release_bundle_version: | |
# description: "Release Bundle Version" | |
# required: false | |
# type: string | |
# signing_key_name: | |
# description: "The GPG/RSA key-pair name given in Artifactory." | |
# required: false | |
# type: string | |
# release_method: | |
# description: "Source type to create release bundle (i.e builds or artifacts)." | |
# required: false | |
# default: artifacts | |
# type: string | |
# box_upload: | |
# type: boolean | |
# default: true | |
# description: "Box upload." | |
# env: | |
# ARTIFACTORY_HOST: ${{ inputs.arti_host }} | |
# ARTIFACTORY_BASE_URL: ${ARTIFACTORY_HOST}/artifactory | |
# RESOLVE_REPO_MIRROR: ${ARTIFACTORY_BASE_URL}/maven | |
# NEXUS_DEPLOY_USER: ${{ secrets.PENTAHO_CICD_ONE_USER }} | |
# NEXUS_DEPLOY_PASSWORD: ${{ secrets.PENTAHO_CICD_ONE_KEY }} | |
# MANIFEST_PATH: $GITHUB_WORKSPACE/${{ inputs.manifest_file_path }} | |
# BOX_CI_FOLDER_ID: 261814384 | |
# jobs: | |
# pentaho-release: | |
# runs-on: [ k8s ] | |
# container: | |
# image: one.hitachivantara.com/devops-docker-release/pentaho/actions-common:20240108.115 | |
# credentials: | |
# username: ${{ secrets.PENTAHO_CICD_ONE_USER }} | |
# password: ${{ secrets.PENTAHO_CICD_ONE_KEY }} | |
# steps: | |
# - name: Checkout source repo | |
# uses: actions/checkout@v4 | |
# with: | |
# ref: ${{ inputs.ref }} | |
# - name: Check if manifest file is present | |
# run: | | |
# if [ ! -f ${{ env.MANIFEST_PATH }} ]; then | |
# echo "Manifest file does not exist." | |
# exit 1 # fails the build | |
# fi | |
# - name: Update versions in manifest | |
# shell: bash | |
# run: | | |
# sed -i "s/\${RELEASE_VERSION}/${{ inputs.release_version }}/g" ${{ env.MANIFEST_PATH }} | |
# major_version=$(echo "${{ inputs.release_version }}" | cut -d '.' -f1,2) | |
# sed -i 's/\${SHORT_VERSION}/'"$major_version"'/g' ${{ env.MANIFEST_PATH }} | |
# no_build_nbr_version=$(echo "${{ inputs.release_version }}" | cut -d '-' -f1) | |
# sed -i 's/\${MAJOR_VERSION}/'"$no_build_nbr_version"'/g' ${{ env.MANIFEST_PATH }} | |
# cat ${{ env.MANIFEST_PATH }} | |
# # expecting the release_version to be something like 9.5.1.0-23 | |
# - name: Work the release version | |
# run: | | |
# version=$(echo "${{ inputs.release_version }}" | cut -d '-' -f1 | xargs) | |
# build_nbr=$(echo "${{ inputs.release_version }}" | cut -d '-' -f2 | xargs) | |
# echo "BUILD_NAME=${{ github.event.repository.name }}-${version}" >> $GITHUB_ENV | |
# echo "BUILD_NUMBER=${build_nbr}" >> $GITHUB_ENV | |
# echo "BUILD_VERSION=${version}" >> $GITHUB_ENV | |
# - name: Config Artifactory in jFrog CLI | |
# run: | | |
# jf config add ${{ inputs.jf_cli_rt_name}} --interactive=false --enc-password=false --basic-auth-only \ | |
# --artifactory-url ${{ env.ARTIFACTORY_BASE_URL }} \ | |
# --password ${{ env.NEXUS_DEPLOY_PASSWORD }} \ | |
# --user ${{ env.NEXUS_DEPLOY_USER }} | |
# - name: Promote artifacts | |
# if: ${{ inputs.promote_artifacts == true }} | |
# run: | | |
# rt_repo='pntpub-maven-release' | |
# if [ "${{ env.REPOSITORY_IS_PRIVATE }}" = "true" ]; then | |
# rt_repo='pntprv-maven-release' | |
# fi | |
# promotion_summary="" | |
# if [ "${{ inputs.dry_run }}" = "true" ]; then | |
# promotion_summary="[Dry run] " | |
# fi | |
# jf rt build-promote "${{ env.BUILD_NAME }}" "${{ env.BUILD_NUMBER }}" ${rt_repo} --dry-run=${{ inputs.dry_run }} | |
# echo "$promotion_summary :frog: Version ${{ inputs.release_version }} was promoted to ${rt_repo}" >> $GITHUB_STEP_SUMMARY | |
# - name: Checkout reusable workflow source repo | |
# uses: actions/checkout@v4 | |
# with: | |
# repository: pentaho/actions-common | |
# path: actions-common | |
# ref: stable | |
# - name: Create Release Bundle | |
# if: ${{ inputs.create_release_bundle == true }} | |
# shell: bash | |
# run: | | |
# python3 -m venv env | |
# source env/bin/activate | |
# pip3 install -q pyyaml dohq-artifactory requests | |
# echo ${{ env.BUILD_NAME }} ${{ env.BUILD_NUMBER }} ${{ env.BUILD_VERSION }} | |
# python3 actions-common/.github/scripts/python/release-bundle.py \ | |
# --build_name ${{ env.BUILD_NAME }} \ | |
# --build_number ${{ env.BUILD_NUMBER }} \ | |
# --build_version ${{ env.BUILD_VERSION }} \ | |
# --rt_auth_username ${{ secrets.PENTAHO_CICD_ONE_USER }} \ | |
# --rt_auth_password ${{ secrets.PENTAHO_CICD_ONE_KEY }} \ | |
# --manifest_file_path ${{ env.MANIFEST_PATH}} \ | |
# --rt_base_url ${{ env.ARTIFACTORY_BASE_URL }} \ | |
# --jf_cli_rt_name ${{ inputs.jf_cli_rt_name }} \ | |
# --dry_run ${{ inputs.dry_run }} \ | |
# --logging_level ${{inputs.logging_level }} \ | |
# --release_bundle_name ${{inputs.release_bundle_name }} \ | |
# --release_bundle_version ${{inputs.release_bundle_version }} \ | |
# --signing_key_name ${{ inputs.signing_key_name }} \ | |
# --arti_host ${{ env.ARTIFACTORY_HOST }} \ | |
# --release_method ${{ inputs.release_method }} | |
# - name: Push artifacts to Box | |
# if: ${{ inputs.box_upload == true }} | |
# shell: bash | |
# run: | | |
# python3 -m venv env | |
# source env/bin/activate | |
# pip3 install -q pyyaml dohq-artifactory requests boxsdk tqdm | |
# echo ${{ env.BUILD_NAME }} ${{ env.BUILD_NUMBER }} ${{ env.BUILD_VERSION }} | |
# python3 actions-common/.github/scripts/python/promote-release-to-box.py \ | |
# --client_id ${{ vars.BOX_APP_CLIENT_ID}} \ | |
# --client_secret ${{ secrets.BOX_APP_CLIENT_SECRET }} \ | |
# --box_subject_id ${{ vars.BOX_SUBJECT_ID }} \ | |
# --build_name ${{ env.BUILD_NAME }} \ | |
# --build_number ${{ env.BUILD_NUMBER }} \ | |
# --build_version ${{ env.BUILD_VERSION }} \ | |
# --rt_auth_username ${{ secrets.PENTAHO_CICD_ONE_USER }} \ | |
# --rt_auth_password ${{ secrets.PENTAHO_CICD_ONE_KEY }} \ | |
# --box_parent_folder_id ${{ env.BOX_CI_FOLDER_ID }} \ | |
# --manifest_file_path ${{ env.MANIFEST_PATH}} \ | |
# --rt_base_url ${{ env.ARTIFACTORY_BASE_URL }} \ | |
# --jf_cli_rt_name ${{ inputs.jf_cli_rt_name }} \ | |
# --dry_run ${{ inputs.dry_run }} \ | |
# --logging_level ${{inputs.logging_level }} | |
# - name: Set Box Summary | |
# if: ${{ inputs.box_upload == true }} | |
# shell: bash | |
# run: | | |
# box_summary="" | |
# if [ "${{ inputs.dry_run }}" = "true" ]; then | |
# box_summary="[Dry run] " | |
# fi | |
# # BOX_FOLDER_ID is an env var that is set inside the promote-release-to-box.py script file | |
# echo "$box_summary :ballot_box: ${{ inputs.release_version }} was uploaded to https://pentaho.app.box.com/folder/$BOX_FOLDER_ID" >> $GITHUB_STEP_SUMMARY |