Skip to content

Commit

Permalink
Merge branch 'main' into fix/1733
Browse files Browse the repository at this point in the history
  • Loading branch information
xpillons committed Oct 16, 2023
2 parents f0a9439 + 7a2a882 commit 9990d0c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/marketplace_application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#
name : marketplace application
on:
push:
tags:
- '*'
pull_request:
branches:
- main
Expand All @@ -15,6 +18,7 @@ on:
env:
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} # https://docs.github.com/en/actions/learn-github-actions/contexts#github-context

defaults:
run:
Expand All @@ -39,5 +43,12 @@ jobs:
run: |
set -e
source /miniconda/bin/activate
./marketplace/solution/build.sh
./marketplace/solution/build.sh $BRANCH_NAME
echo "escaped_branch_name=${BRANCH_NAME//\//_}" >> $GITHUB_ENV
- uses: actions/upload-artifact@v3
# if: startsWith(github.ref, 'refs/tags/v')
with:
name: marketplace package
path: marketplace/solution/build_${{ env.escaped_branch_name }}
if-no-files-found: error
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ deploy/*params.json
# build dir that may have .git moduless
toolset/scripts/ansible-build

marketplace/solution/build
marketplace/solution/build.zip
marketplace/solution/build_*
marketplace/solution/build_*.zip

# arm toolkit
marketplace/solution/arm-ttk
Expand Down
20 changes: 15 additions & 5 deletions marketplace/solution/build.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
#!/bin/bash
set -e
# This script builds the ARM template and UI definition for the azhop marketplace solution
BUILD_NAME=${1:-main}

THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
AZHOP_ROOT=${THIS_DIR}/../..


if [ -d ${AZHOP_ROOT}/miniconda ]; then
echo "Activating conda environment"
source ${AZHOP_ROOT}/miniconda/bin/activate
fi
load_miniconda() {
# Note: packaging this inside a function to avoid forwarding arguments to conda
if [ -d ${AZHOP_ROOT}/miniconda ]; then
echo "Activating conda environment"
source ${AZHOP_ROOT}/miniconda/bin/activate
fi
}
load_miniconda

build_dir="${THIS_DIR}/build"
build_dir="${THIS_DIR}/build_${BUILD_NAME//\//_}"
rm -rf $build_dir
mkdir -p $build_dir
echo "Converting YAML config to JSON"
Expand All @@ -28,6 +35,9 @@ jq --argfile azhopConfig $build_dir/config.json '.parameters.outputs.azhopConfig
| sed "s/_X3i_/int(first(skip(split(steps('network').baseIpAddress,'.'),2)))/g" \
| sed "s/_X4i_/int(last(split(steps('network').baseIpAddress,'.')))/g" \
> $build_dir/createUiDefinition.json
# Set the branch name in the UI definition and parameters
sed -i "s|__BRANCH_NAME__|${BUILD_NAME}|g" $build_dir/createUiDefinition.json

rm $build_dir/config.json
echo "Converting Bicep to ARM template"
az bicep build --file ${AZHOP_ROOT}/bicep/mainTemplate.bicep --outdir $build_dir
Expand Down
2 changes: 1 addition & 1 deletion marketplace/solution/ui_definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@
"name": "branchName",
"type": "Microsoft.Common.TextBox",
"label": "Branch Name",
"defaultValue": "main",
"defaultValue": "__BRANCH_NAME__",
"toolTip": "Branch of the azhop repo to pull - Default to main",
"constraints": {
"required": false,
Expand Down

0 comments on commit 9990d0c

Please sign in to comment.