Skip to content

Commit

Permalink
Fixed bug in build.sh (missing bakery file)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmeggle committed Aug 23, 2022
1 parent a91d889 commit 6bd1f30
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 12 deletions.
28 changes: 21 additions & 7 deletions .devcontainer/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ set -e
# After the MKP has been built, the script check if it runs within a Github
# Workflow. If so, it sets the artifact name as output variable.

if [ -z $WORKSPACE ]; then
echo "ERROR: WORKSPACE environment variable not set. Exiting."
exit 1
fi

if [ -z $OMD_SITE ]; then
echo "ERROR: You do not seem to be on a OMD site (variable OMD_SITE not set). Exiting."
exit 1
fi

set -u
# CMK Major version
MVERSION="$(cat $OMD_ROOT/.version_meta/version | cut -d '.' -f1)"
NAME="robotmk"
Expand All @@ -18,18 +29,18 @@ PACKAGEFILE=$OMD_ROOT/var/check_mk/packages/$NAME
# get the current tag (Release) or commit hash (Artifact)
export RMK_VERSION=$(git describe --exact-match --tags 2> /dev/null || git rev-parse --short HEAD)


echo "▹ Removing old packages..."
rm -f $OMD_ROOT/var/check_mk/packages/*

echo "---------------------------------------------"
echo "* Merging the common package info with version $MVERSION specific..."
echo " Merging the common package info with version $MVERSION specific..."
jq -s '.[0] * .[1]' $WORKSPACE/package/pkginfo_common $WORKSPACE/package/v$MVERSION/pkginfo | jq '. + {version:env.RMK_VERSION}' > $PACKAGEFILE
echo "---------------------------------------------"
echo "$PACKAGEFILE:"
cat $PACKAGEFILE
echo "---------------------------------------------"
echo "* Building MKP '$NAME' on $RMK_VERSION for CMK version $MVERSION..."
set -x
echo " Building MKP '$NAME' on $RMK_VERSION for CMK version $MVERSION..."
# set -x
ls -la $PACKAGEFILE
mkp -v pack $NAME
FILE=$(ls -rt1 *.mkp | tail -1)
Expand All @@ -38,17 +49,20 @@ FILE=$(ls -rt1 *.mkp | tail -1)
NEWFILENAME=$NAME.$RMK_VERSION-cmk$MVERSION.mkp
mv $FILE $NEWFILENAME
echo "---------------------------------------------"
echo "📦 Package:"
echo "$NEWFILENAME"


if [ -n "$GITHUB_WORKSPACE" ]; then
echo "* Set Outputs for GitHub Workflow steps"
if [ -n "${GITHUB_WORKSPACE-}" ]; then
echo " Set Outputs for GitHub Workflow steps"
echo "::set-output name=pkgfile::$NEWFILENAME"
# echo "::set-output name=pkgname::${NAME}"
VERSION=$(jq -r '.version' $PACKAGEFILE)
# echo "::set-output name=pkgversion::$RMK_VERSION"
# echo "::set-output name=cmkmversion::$MVERSION"
echo "::set-output name=artifactname::$NEWFILENAME"
else
echo "* (No GitHub Workflow detected)"
echo "(No GitHub Workflow detected)"
fi
echo "END OF build.sh"
echo "---------------------------------------------"
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

* Documentation: Added [FAQs](./FAQ.md) with design decicions
* Documentation: Added [FAQs](./FAQ.md) with design decisions
* Check: Added the possibility to temporarily skip the execution of suites by placing a `DISABLED` (case sensitive) file in the suite's root folder. (#192)
Robotmk will silently ignore this suite as long the DISABLED file is there.
(Thanks Marcus for this suggestion - this is the perfect alternative to commenting out the suite in `robotmk.yml` manually).
Expand Down
10 changes: 10 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,16 @@ Debugging `robotmk.py` and `robotmk-runner.py` from the devcontainer is not stra

After that, set a breakpoint in VS Code in `agents_plugins/robotmk-runner.py`. Also select the debugging configuration to "devc V2.x robotmk-runner" and press F5 to start debugging.

### Building a MKP inside of the Container

To test how the Github workflow will build MKPs for Robotmk, you can run the build script within the container locally.

In VS Code,
- run command "Tasks chooser: Select Task" => "Build Robotmk MKP"
- run command "Tasks: run task" to execute the build script

-

### Write a changelog

Robotmk's [CHANGELOG.md](CHANGELOG.md) is based on [](https://keepachangelog.com/).
Expand Down
5 changes: 1 addition & 4 deletions package/v2/pkginfo
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
"version.min_required": "2.0.0",
"files": {
"agent_based": ["robotmk.py"],
"agents": ["plugins/robotmk-runner.py", "plugins/robotmk.py"],
"lib": [
"check_mk/base/cee/plugins/bakery/robotmk.py"
]
"agents": ["plugins/robotmk-runner.py", "plugins/robotmk.py", "bakery/robotmk.py"]
}
}

0 comments on commit 6bd1f30

Please sign in to comment.