generated from meshery/meshery
-
Notifications
You must be signed in to change notification settings - Fork 15
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
[CI] partial release and install fixes #46
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
run: | ||
timeout: 5m | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- gofmt | ||
- gosimple | ||
- govet | ||
- misspell | ||
- revive | ||
- unused | ||
- staticcheck | ||
|
||
linters-settings: | ||
gofmt: | ||
simplify: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
GOVERSION = 1.23 | ||
GOVERSION = 1.21 | ||
PROVIDER_TOKEN="dev_token" | ||
MESHERY_CLOUD_API_BASE_URL="http://localhost:9876" | ||
MESHERY_API_BASE_URL="http://localhost:3000" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
name: "kanvas-snapshot" | ||
version: "0.1.0" | ||
version: "0.2.0" | ||
usage: "Generate a visual snapshot of your Helm chart as a Meshery Snapshot" | ||
description: "A Helm plugin to generate Meshery Snapshots from Helm charts using a custom Go binary" | ||
command: "$HELM_PLUGIN_DIR/bin/kanvas-snapshot-linux-amd64" | ||
platformCommand: | ||
description: "A Helm plugin to generate Kanvas Snapshots from Helm charts using a custom Go binary" | ||
command: "$HELM_PLUGIN_DIR/bin/kanvas-snapshot" | ||
platformCommand: | ||
- os: linux | ||
arch: amd64 | ||
command: "$HELM_PLUGIN_DIR/bin/kanvas-snapshot-linux-amd64" | ||
command: "$HELM_PLUGIN_DIR/bin/kanvas-snapshot" | ||
- os: darwin | ||
arch: amd64 | ||
command: "$HELM_PLUGIN_DIR/bin/kanvas-snapshot-darwin-amd64" | ||
command: "$HELM_PLUGIN_DIR/bin/kanvas-snapshot" | ||
- os: windows | ||
arch: amd64 | ||
command: "$HELM_PLUGIN_DIR/bin/kanvas-snapshot-windows-amd64.exe" | ||
command: "$HELM_PLUGIN_DIR/bin/kanvas-snapshot.exe" | ||
hooks: | ||
install: | | ||
echo "Snapshot plugin installed." | ||
uninstall: | | ||
echo "Snapshot plugin uninstalled." | ||
install: "$HELM_PLUGIN_DIR/scripts/install-binary.sh" | ||
update: "$HELM_PLUGIN_DIR/scripts/install-binary.sh" | ||
uninstall: echo "Snapshot plugin uninstalled." |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
# // Copyright Meshery Authors | ||
# // | ||
# // Licensed under the Apache License, Version 2.0 (the "License"); | ||
# // you may not use this file except in compliance with the License. | ||
# // You may obtain a copy of the License at | ||
# // | ||
# // http://www.apache.org/licenses/LICENSE-2.0 | ||
# // | ||
# // Unless required by applicable law or agreed to in writing, software | ||
# // distributed under the License is distributed on an "AS IS" BASIS, | ||
# // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# // See the License for the specific language governing permissions and | ||
# // limitations under the License. | ||
|
||
# This script installs the Helm Kanvas Snapshot plugin. | ||
|
||
#!/usr/bin/env sh | ||
|
||
echo "Installing Helm Kanvas Snapshot plugin..." | ||
|
||
CLI="kanvas-snapshot" | ||
REPO_NAME="helm-kanvas-snapshot" | ||
PROJECT_ORG="${PROJECT_ORG:-meshery}" | ||
PROJECT_GH="$PROJECT_ORG/$REPO_NAME" | ||
HELM_BIN="/usr/local/bin/helm" | ||
export GREP_COLOR="never" | ||
|
||
HELM_MAJOR_VERSION=$("${HELM_BIN}" version --client --short | awk -F '.' '{print $1}') | ||
|
||
# : ${HELM_PLUGIN_DIR:="$("${HELM_BIN}" home --debug=false)/plugins/helm-diff"} | ||
|
||
# Handle HELM_PLUGIN_DIR filepath based on OS. Use *nix-based filepathing | ||
|
||
if type cygpath >/dev/null 2>&1; then | ||
HELM_PLUGIN_DIR=$(cygpath -u $HELM_PLUGIN_DIR) | ||
fi | ||
|
||
if [ "$SKIP_BIN_INSTALL" = "1" ]; then | ||
echo "Skipping binary install" | ||
exit | ||
fi | ||
|
||
# Identify systm architecture | ||
initArch() { | ||
ARCH=$(uname -m) | ||
case $ARCH in | ||
armv5*) ARCH="armv5" ;; | ||
armv6*) ARCH="armv6" ;; | ||
armv7*) ARCH="armv7" ;; | ||
aarch64) ARCH="arm64" ;; | ||
x86) ARCH="386" ;; | ||
x86_64) ARCH="x86_64" ;; | ||
i686) ARCH="386" ;; | ||
i386) ARCH="386" ;; | ||
esac | ||
echo "ARCH: $ARCH" | ||
} | ||
|
||
# Identify operating system | ||
initOS() { | ||
OS=$(uname | tr '[:upper:]' '[:lower:]') | ||
|
||
case "$OS" in | ||
# Msys support | ||
msys*) OS='windows' ;; | ||
# Minimalist GNU for Windows | ||
mingw*) OS='windows' ;; | ||
darwin) OS='darwin' ;; | ||
esac | ||
echo "OS: $OS" | ||
} | ||
|
||
# verifySupported checks that the os/arch combination is supported for | ||
# binary builds. | ||
verifySupported() { | ||
supported="linux_amd64\ndarwin_x86_64\nlinux_arm64\ndarwin_arm64\nwindows_amd64" | ||
if ! echo "${supported}" | grep -q "${OS}_${ARCH}"; then | ||
echo "No prebuilt binary for ${OS}_${ARCH}." | ||
exit 1 | ||
fi | ||
|
||
if ! type "curl" >/dev/null && ! type "wget" >/dev/null; then | ||
echo "Either curl or wget is required" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# getDownloadURL checks the latest available version. | ||
getDownloadURL() { | ||
#version=$(git -C "$HELM_PLUGIN_DIR" describe --tags --exact-match 2>/dev/null || :) | ||
echo "OS: $OS" | ||
|
||
version="$(cat $HELM_PLUGIN_DIR/plugin.yaml | grep "version" | cut -d '"' -f 2)" | ||
if [ -n "$version" ]; then | ||
DOWNLOAD_URL="https://github.com/$PROJECT_GH/releases/download/v$version/$CLI_$version_$OS_$ARCH.tar.gz" | ||
echo "DOWNLOAD_URL1: $DOWNLOAD_URL" | ||
# https://github.com/meshery/helm-kanvas-snapshot/releases/download/v0.2.0/kanvas-snapshot_0.2.0_Darwin_x86_64.tar.gz | ||
else | ||
# Use the GitHub API to find the download url for this project. | ||
url="https://api.github.com/repos/$PROJECT_GH/releases/latest" | ||
if type "curl" >/dev/null; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. verfiySupported checks for curl and wget already, do we need these checks again ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably not. Please change at-will |
||
DOWNLOAD_URL=$(curl -s $url | grep $OS_$ARCH\" | awk '/\"browser_download_url\":/{gsub( /[,\"]/,"", $2); print $2}') | ||
echo "DOWNLOAD_URL2: $DOWNLOAD_URL" | ||
|
||
elif type "wget" >/dev/null; then | ||
DOWNLOAD_URL=$(wget -q -O - $url | grep $OS_$ARCH\" | awk '/\"browser_download_url\":/{gsub( /[,\"]/,"", $2); print $2}') | ||
echo "DOWNLOAD_URL3: $DOWNLOAD_URL" | ||
|
||
fi | ||
fi | ||
|
||
} | ||
|
||
# downloadFile downloads the latest binary package and also the checksum | ||
# for that binary. | ||
downloadFile() { | ||
BINDIR="$HELM_PLUGIN_DIR/bin" | ||
rm -rf "$BINDIR" | ||
mkdir -p "$BINDIR" | ||
echo "Downloading $DOWNLOAD_URL" | ||
if type "curl" >/dev/null; then | ||
HTTP_CODE=$(curl -sL --write-out "%{http_code}" "$DOWNLOAD_URL" --output "$BINDIR/$CLI") | ||
if [ ${HTTP_CODE} -ne 200 ]; then | ||
exit 1 | ||
fi | ||
elif type "wget" >/dev/null; then | ||
wget -q -O "$BINDIR/$CLI" "$DOWNLOAD_URL" | ||
fi | ||
|
||
chmod +x "$BINDIR/$CLI" | ||
|
||
} | ||
|
||
# fail_trap is executed if an error occurs. | ||
fail_trap() { | ||
result=$? | ||
if [ "$result" != "0" ]; then | ||
echo "Failed to install $CLI" | ||
printf "\tFor support, go to https://discuss.layer5.io.\n" | ||
fi | ||
exit $result | ||
} | ||
|
||
# testVersion tests the installed client to make sure it is working. | ||
testVersion() { | ||
set +e | ||
echo "$CLI installed into $HELM_PLUGIN_DIR/$CLI" | ||
"${HELM_PLUGIN_DIR}/bin/$CLI" version | ||
echo "`helm $CLI --help` to get started." | ||
set -e | ||
} | ||
|
||
|
||
# Execution | ||
|
||
#Stop execution on any error | ||
trap "fail_trap" EXIT | ||
set -e | ||
initArch | ||
initOS | ||
verifySupported | ||
getDownloadURL | ||
downloadFile | ||
testVersion |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For platforms other than windows, the HELM_PLUGIN_DIR is going to be "" and eventually the CWD is used for downloading the files, right?