New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Unable to install grafana-app-sdk@latest #189
Comments
Looks like this is an issue since the pinning of The longer-term fix is to split the CLI and codegen packages into a separate go module from the libraries (as the reason the version has to be pinned with the replace directive is that |
We should also probably add a point to the workflow to test this. In the meantime, a workaround is:
|
Also ran into this on
|
@L2D2Grafana @IfSentient you can download the binary from GH releases page - it's how we got it automated in a few places. |
Here's a script we're using together with a Makefile for installing the SDK: #!/bin/sh
set -e
version=$1
baseUrl="https://github.com/grafana/grafana-app-sdk/releases/download/v${version}"
if [[ -z $version ]]; then
echo "Please specify which version you want to install!"
exit 1
fi
outDir=$2
if [[ -z $outDir ]]; then
outDir="./bin"
fi
platform=""
case $(uname -s) in
Linux*) platform=linux;;
Darwin*) platform=darwin;;
esac
if [[ -z $platform ]]; then
echo "Unsupported platform!"
exit 1
fi
arch=""
case $(uname -m) in
x86_64) arch="amd64" ;;
arm) arch="arm64" ;;
esac
if [[ -z $arch ]]; then
echo "Unsupported architecure!"
exit 1
fi
asset="grafana-app-sdk_${version}_${platform}_${arch}.tar.gz"
url="${baseUrl}/${asset}"
echo "Will download from: ${url} into ${outDir}"
curl -Ls "${url}" | tar xvzf - -C "${outDir}"
rm -f "${outDir}/LICENSE" "${outDir}/README.md"
mv "${outDir}/grafana-app-sdk" "${outDir}/grafana-app-sdk-${version}" # Targets for installing the SDK
SDK_DIR := bin
SDK_VER := 0.14.6
SDK_CLI := $(SDK_DIR)/grafana-app-sdk-$(SDK_VER)
$(SDK_CLI):
mkdir -p $(SDK_DIR)
./scripts/install-sdk.sh $(SDK_VER) $(SDK_DIR)
sdk-cli: $(SDK_CLI)
# Targets for generating Go types & CRDs using the SDK
KINDSS_DIR := kinds
CRDGEN_DIR := ops/crds
GOFGEN_DIR := pkg/generated
KIND_FILES := $(shell find $(KINDSS_DIR) -type f -name "*.cue")
$(GOFGEN_DIR): $(KIND_FILES) $(SDK_CLI)
@$(SDK_CLI) generate --cuepath=$(KINDSS_DIR) --crdencoding=json --crdpath=$(CRDGEN_DIR) --gogenpath=$(GOFGEN_DIR)
@touch $@
go/generate: $(GOFGEN_DIR) |
…190) This PR introduces extra go submodules for the `cmd/grafana-app-sdk` and `plugin` directories, and a `go.work` to allow them to incorporate properly. It also moves the `codegen`, `kindsys`, and `internal` packages into the `cmd/grafana-app-sdk` submodule. This accomplishes two major things: 1. The CLI and library dependencies are no longer "mixed." The CLI still have some upward dependencies on the`resource` and `k8s` packages, but now using any of the libraries (`resource`, `k8s`, `operator`, etc.) does not require the dependencies of the `codegen` package or CLI. The `plugin` package has been similarly isolated because dependency versions in the root module will overwrite the ones in the submodule, and the `codegen` package requires an older version of `getkin/kin-openapi` than `plugin` requires. 2. Removes the need for the `replace` directive version pinning, which was preventing `go install` from working correctly, and _also_ required that a user of the app-sdk as a library also provided that `replace` directive in their `go.mod`. Resolves #189
My proposed fix didn't quite work, will try another approach for now. |
Description
Error
Perhaps it is due to this line https://github.com/grafana/grafana-app-sdk/blob/main/go.mod#L6
Successful older versions install
The text was updated successfully, but these errors were encountered: