Add docs and tests for plugins setup
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
This commit is contained in:
+11
-10
@@ -18,9 +18,10 @@ inputs:
|
||||
required: false
|
||||
plugin-dir:
|
||||
description: >
|
||||
Directory where requested plugins are installed. When plugins are installed,
|
||||
the action exports `FLUXCD_PLUGINS` for subsequent steps. Defaults to a
|
||||
`plugins` directory alongside the Flux binary in $RUNNER_TOOL_CACHE.
|
||||
Directory where requested plugins are installed. This input is only used when
|
||||
`plugins` is set. When plugins are installed, the action exports
|
||||
`FLUXCD_PLUGINS` for subsequent steps. Defaults to a `plugins` directory
|
||||
alongside the Flux binary in $RUNNER_TOOL_CACHE.
|
||||
required: false
|
||||
bindir:
|
||||
description: "Alternative location for the Flux binary, defaults to path relative to $RUNNER_TOOL_CACHE."
|
||||
@@ -58,13 +59,13 @@ runs:
|
||||
if [[ $VERSION = v* ]]; then
|
||||
VERSION="${VERSION:1}"
|
||||
fi
|
||||
echo installed-flux-version="$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "installed-flux-version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
|
||||
OS=$(echo "${RUNNER_OS}" | tr '[:upper:]' '[:lower:]')
|
||||
if [[ "$OS" == "macos" ]]; then
|
||||
OS="darwin"
|
||||
fi
|
||||
echo os="$OS" >> $GITHUB_OUTPUT
|
||||
echo "os=$OS" >> "$GITHUB_OUTPUT"
|
||||
|
||||
ARCH=$(echo "${RUNNER_ARCH}" | tr '[:upper:]' '[:lower:]')
|
||||
if [[ "$ARCH" == "x64" ]]; then
|
||||
@@ -72,7 +73,7 @@ runs:
|
||||
elif [[ "$ARCH" == "x86" ]]; then
|
||||
ARCH="386"
|
||||
fi
|
||||
echo arch="$ARCH" >> $GITHUB_OUTPUT
|
||||
echo "arch=$ARCH" >> "$GITHUB_OUTPUT"
|
||||
|
||||
FLUX_EXEC_FILE="flux"
|
||||
if [[ "$OS" == "windows" ]]; then
|
||||
@@ -82,7 +83,7 @@ runs:
|
||||
if [[ -z "$FLUX_TOOL_DIR" ]]; then
|
||||
FLUX_TOOL_DIR="${RUNNER_TOOL_CACHE}/flux2/${VERSION}/${OS}/${ARCH}"
|
||||
fi
|
||||
if [[ ! -x "$FLUX_TOOL_DIR/FLUX_EXEC_FILE" ]]; then
|
||||
if [[ ! -x "$FLUX_TOOL_DIR/$FLUX_EXEC_FILE" ]]; then
|
||||
DL_DIR="$(mktemp -dt flux2-XXXXXX)"
|
||||
trap 'rm -rf $DL_DIR' EXIT
|
||||
|
||||
@@ -173,10 +174,10 @@ runs:
|
||||
run: |
|
||||
flux_version="$(flux -v 2>/dev/null | awk '{print $3}')"
|
||||
if flux plugin --help >/dev/null 2>&1; then
|
||||
echo plugin-support="yes" >> $GITHUB_OUTPUT
|
||||
echo "plugin-support=yes" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
else
|
||||
echo plugin-support="no" >> $GITHUB_OUTPUT
|
||||
echo "plugin-support=no" >> "$GITHUB_OUTPUT"
|
||||
msg="Installed Flux version ${flux_version:-unknown} does not support plugins; need >= 2.9.0. Requested plugins cannot be installed."
|
||||
echo "::error title=Unsupported Flux version::$msg"
|
||||
echo "> [!CAUTION]" >> $GITHUB_STEP_SUMMARY
|
||||
@@ -224,4 +225,4 @@ runs:
|
||||
if: steps.plugin-support-gate.outputs.plugin-support == 'yes'
|
||||
shell: bash
|
||||
run: |
|
||||
echo "plugin-dir=$FLUXCD_PLUGINS" >> $GITHUB_OUTPUT
|
||||
echo "plugin-dir=$FLUXCD_PLUGINS" >> "$GITHUB_OUTPUT"
|
||||
|
||||
Reference in New Issue
Block a user