From 5888931937397958a73f5009d11218e4586c7e50 Mon Sep 17 00:00:00 2001 From: Rajat Jindal Date: Mon, 3 Feb 2020 22:00:42 +0530 Subject: [PATCH 1/3] use github release tag instead of manual tag --- .travis.yml | 6 ++---- VERSION | 1 - scripts/verify_version.sh | 10 ---------- 3 files changed, 2 insertions(+), 15 deletions(-) delete mode 100644 VERSION delete mode 100755 scripts/verify_version.sh diff --git a/.travis.yml b/.travis.yml index 8fdd559..59eff8c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,13 +11,11 @@ before_install: - sudo apt-get install -y libpcap-dev gcc script: - - make verify_version - make all - make static-tcpdump before_deploy: - make package - - git tag "$(cat VERSION)" deploy: provider: releases @@ -26,5 +24,5 @@ deploy: - ksniff.zip skip_cleanup: true on: - tag: true - branch: master \ No newline at end of file + tags: true + branch: master diff --git a/VERSION b/VERSION deleted file mode 100644 index 2f93383..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -v1.3.4 \ No newline at end of file diff --git a/scripts/verify_version.sh b/scripts/verify_version.sh deleted file mode 100755 index 4359618..0000000 --- a/scripts/verify_version.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -THIS_BRANCH_VERSION=$(cat VERSION) -if [[ $(git tag -l "$THIS_BRANCH_VERSION") ]]; then - echo "[-] Version $THIS_BRANCH_VERSION is already tagged, please increase plugin version" - exit 1 -else - echo "[-] Version $THIS_BRANCH_VERSION is not tagged yet." - exit 0 -fi \ No newline at end of file From f395df9d67199ca80077d2adf599c461851fe364 Mon Sep 17 00:00:00 2001 From: Rajat Jindal Date: Mon, 3 Feb 2020 22:01:25 +0530 Subject: [PATCH 2/3] change deploy value to an array --- .travis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 59eff8c..05301af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,11 +18,11 @@ before_deploy: - make package deploy: - provider: releases - api_key: $GITHUB_OAUTH_TOKEN - file: - - ksniff.zip - skip_cleanup: true - on: - tags: true - branch: master + - provider: releases + api_key: $GITHUB_OAUTH_TOKEN + file: + - ksniff.zip + skip_cleanup: true + on: + tags: true + branch: master From 11933fd2a0f7ede94b5eb9c5a7fc9594fa090cf5 Mon Sep 17 00:00:00 2001 From: Rajat Jindal Date: Mon, 3 Feb 2020 22:02:21 +0530 Subject: [PATCH 3/3] add another deploy element to publish krew-index --- .krew.yaml | 51 ++++++++++++++++++++++++++++++++++++ .travis.yml | 6 +++++ scripts/update-krew-index.sh | 7 +++++ 3 files changed, 64 insertions(+) create mode 100644 .krew.yaml create mode 100644 scripts/update-krew-index.sh diff --git a/.krew.yaml b/.krew.yaml new file mode 100644 index 0000000..dc1269b --- /dev/null +++ b/.krew.yaml @@ -0,0 +1,51 @@ +apiVersion: krew.googlecontainertools.github.com/v1alpha2 +kind: Plugin +metadata: + name: sniff +spec: + version: {{ .TagName }} + homepage: https://github.com/eldadru/ksniff + platforms: + - {{ addURIAndSha "https://github.com/eldadru/ksniff/releases/download/{{ .TagName }}/ksniff.zip" .TagName }} + bin: kubectl-sniff + files: + - from: ./kubectl-sniff-darwin + to: kubectl-sniff + - from: ./static-tcpdump + to: static-tcpdump + selector: + matchLabels: + os: darwin + arch: amd64 + - {{ addURIAndSha "https://github.com/eldadru/ksniff/releases/download/{{ .TagName }}/ksniff.zip" .TagName }} + bin: kubectl-sniff + files: + - from: ./kubectl-sniff + to: kubectl-sniff + - from: ./static-tcpdump + to: static-tcpdump + selector: + matchLabels: + os: linux + arch: amd64 + - {{ addURIAndSha "https://github.com/eldadru/ksniff/releases/download/{{ .TagName }}/ksniff.zip" .TagName }} + bin: kubectl-sniff.exe + files: + - from: ./kubectl-sniff-windows + to: kubectl-sniff.exe + - from: ./static-tcpdump + to: static-tcpdump + selector: + matchLabels: + os: windows + arch: amd64 + shortDescription: Start a remote packet capture on pods using tcpdump and wireshark + caveats: | + This plugin needs the following programs: + * wireshark (optional, used for live capture) + description: | + When working with micro-services, many times it's very helpful to get a capture of the network + activity between your micro-service and it's dependencies. + + ksniff use kubectl to upload a statically compiled tcpdump binary to your pod and redirecting it's + output to your local Wireshark for smooth network debugging experience. diff --git a/.travis.yml b/.travis.yml index 05301af..f461464 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,3 +26,9 @@ deploy: on: tags: true branch: master + - provider: script + script: + - env GITHUB_TOKEN=${GITHUB_OAUTH_TOKEN} bash scripts/update-krew-index.sh + on: + tags: true + branch: master \ No newline at end of file diff --git a/scripts/update-krew-index.sh b/scripts/update-krew-index.sh new file mode 100644 index 0000000..64cf29b --- /dev/null +++ b/scripts/update-krew-index.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +export KREW_RELEASE_BOT_VERSION=v0.0.36 + +curl -LO https://github.com/rajatjindal/krew-release-bot/releases/download/${KREW_RELEASE_BOT_VERSION}/krew-release-bot_${KREW_RELEASE_BOT_VERSION}_linux_amd64.tar.gz +tar -xvf krew-release-bot_${KREW_RELEASE_BOT_VERSION}_linux_amd64.tar.gz +./krew-release-bot action \ No newline at end of file