Skip to content
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

[cherry-pick release-1.5 ]Capture endpoint hash for global plugins telemetry #846

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1a04b45
Update documentation to use new `tanzu-cli-installer-packages` repo f…
anujc25 Sep 29, 2024
188a7d7
Use Docker images from ghcr.io/vmware-tanzu (#818)
anujc25 Oct 3, 2024
0261b59
Add generate-docs and Update the command docs (#822)
anujc25 Oct 4, 2024
2348510
Bump github.com/hashicorp/go-retryablehttp from 0.7.2 to 0.7.7
dependabot[bot] Oct 7, 2024
a0871ed
Bump github.com/docker/docker
dependabot[bot] Oct 7, 2024
f76fd0b
Support login to UAA using API token
vuil Oct 3, 2024
f9aa5eb
Fix incorrect storing of expiration time
vuil Oct 4, 2024
125e525
Add support to generate API token with `tanzu api-token create` (#820)
anujc25 Oct 8, 2024
3e43173
Refresh token with custom TLS config
vuil Oct 8, 2024
007042c
Simplify auth with api token against uaa
vuil Oct 8, 2024
cb7b4de
Update the cert map on successful non interactive login
vuil Oct 9, 2024
db29379
Update UAA token refresh logic
vuil Oct 10, 2024
edcc80b
Improve startup speed (#821)
marckhouzam Oct 29, 2024
77d1eaf
Print stderr output of plugin when doing completion (#827)
marckhouzam Nov 6, 2024
b4ea0e6
Do not hide remapped subcommands (#831)
marckhouzam Nov 19, 2024
8b3979d
Update kube context with certmap info if necessary
vuil Nov 13, 2024
4975daa
Bump github.com/golang-jwt/jwt/v4 from 4.5.0 to 4.5.1 (#828)
dependabot[bot] Jan 2, 2025
fc564a3
Bump golang.org/x/crypto from 0.21.0 to 0.31.0, Bump golang.org/x/net…
anujc25 Jan 2, 2025
c699b39
Update cosign and k8s.io dependencies (#835)
anujc25 Jan 7, 2025
18b6706
Allow building multiple RPM packages (#837)
marckhouzam Jan 9, 2025
49a4bad
Implement singleton pattern for NewRootCmd to prevent multiple creati…
anujc25 Jan 14, 2025
d6eaf4c
Document how to install on RHEL/CentOS 8/9 (#838)
marckhouzam Jan 14, 2025
29f9488
Update co-existence tests with updated legacy CLI URL
prkalle Jan 27, 2025
3db418e
Capture endpoint hash for global plugins telemetry
prkalle Jan 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.21
- name: Set up Go 1.23
uses: actions/setup-go@v3
with:
go-version: 1.21
go-version: 1.23
id: go

- name: Config credentials
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cli-coexistence_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: 1.21
go-version: 1.23
id: go

- name: Setup dependencies
Expand All @@ -49,7 +49,7 @@ jobs:
build-args: |
TANZU_CLI_COEXISTENCE_LEGACY_TANZU_CLI_DIR=/app/legacy-tanzu-cli
TANZU_CLI_COEXISTENCE_LEGACY_TANZU_CLI_VERSION=v0.28.1
TANZU_CLI_COEXISTENCE_LEGACY_TANZU_CLI_URL=https://ent.box.com/shared/static/984uoy8mayq6rpdrfwh1omxurc0ixo57.gz
TANZU_CLI_COEXISTENCE_LEGACY_TANZU_CLI_URL=https://storage.googleapis.com/tanzu-cli-installer-packages/bin/v0.28.1/tanzu-cli-linux-amd64.tar.gz
TANZU_CLI_COEXISTENCE_NEW_TANZU_CLI_DIR=/app/tanzu-cli

- name: Run Docker image
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cli_core_e2e_sample-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.21
go-version: 1.23
id: go

- name: go cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cli_core_e2e_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.21
go-version: 1.23
id: go

- name: go cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cli_core_unit_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.21
go-version: 1.23
id: go

- name: go cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.21
go-version: 1.23
id: go

- name: Check out code into the Go module directory
Expand Down
4 changes: 3 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ issues:
- 'declaration of "(err|ctx)" shadows declaration at'
- "unnamedResult: consider giving a name to these results"
- "(Expect directory permissions to be 0750 or less|Expect (WriteFile|file) permissions to be 0600 or less)"
- 'dot-imports: should not use dot imports'
- 'unused-parameter:'

exclude-rules:
- path: _test\.go
Expand Down Expand Up @@ -149,4 +151,4 @@ run:
# golangci.com configuration
# https://github.com/golangci/golangci/wiki/Configuration
service:
golangci-lint-version: 1.46.0 # use the fixed version to not introduce new linters unexpectedly
golangci-lint-version: 1.63.3 # use the fixed version to not introduce new linters unexpectedly
28 changes: 23 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -189,18 +189,33 @@ apt-package-in-docker: ## Build a debian package from within a container already
.PHONY: apt-package
apt-package: apt-package-only apt-package-repo ## Build a debian package to use with APT

.PHONY: rpm-package
rpm-package: ## Build an RPM package
.PHONY: rpm-package-only
rpm-package-only: ## Build an RPM package
@if [ "$$(command -v docker)" == "" ]; then \
echo "Docker required to build rpm package" ;\
exit 1 ;\
fi
docker run --rm -e VERSION=$(BUILD_VERSION) -e RPM_PACKAGE_NAME=$(RPM_PACKAGE_NAME) -e RPM_SIGNER=$(RPM_SIGNER) -v $(ROOT_DIR):$(ROOT_DIR) $(RPM_IMAGE) $(ROOT_DIR)/hack/rpm/build_package.sh

.PHONY: rpm-package-repo
rpm-package-repo: ## Build an RPM package repository
@if [ "$$(command -v docker)" == "" ]; then \
echo "Docker required to build rpm package" ;\
exit 1 ;\
fi
docker run --rm -e VERSION=$(BUILD_VERSION) -e RPM_SIGNER=$(RPM_SIGNER) -e RPM_METADATA_BASE_URI=$(RPM_METADATA_BASE_URI) -v $(ROOT_DIR):$(ROOT_DIR) $(RPM_IMAGE) $(ROOT_DIR)/hack/rpm/build_package.sh
docker run --rm -e VERSION=$(BUILD_VERSION) -e RPM_SIGNER=$(RPM_SIGNER) -e RPM_METADATA_BASE_URI=$(RPM_METADATA_BASE_URI) -v $(ROOT_DIR):$(ROOT_DIR) $(RPM_IMAGE) $(ROOT_DIR)/hack/rpm/build_package_repo.sh

.PHONY: rpm-package-in-docker
rpm-package-in-docker: ## Build an RPM package from within a container already
VERSION=$(BUILD_VERSION) $(ROOT_DIR)/hack/rpm/build_package.sh

.PHONY: rpm-package-repo-in-docker
rpm-package-repo-in-docker: ## Build an RPM package repository from within a container already
VERSION=$(BUILD_VERSION) $(ROOT_DIR)/hack/rpm/build_package_repo.sh

.PHONY: rpm-package
rpm-package: rpm-package-only rpm-package-repo ## Build an RPM package and repository to use with YUM/DNF

.PHONY: choco-package
choco-package: ## Build a Chocolatey package
@if [ "$$(command -v docker)" = "" ]; then \
Expand Down Expand Up @@ -367,7 +382,10 @@ generate-controller-code: $(CONTROLLER_GEN) ## Generate code via controller-gen
generate-manifests: ## Generate API manifests e.g. CRD
$(MAKE) generate-controller-code GENERATOR=crd OPTIONS="output:crd:artifacts:config=$(ROOT_DIR)/apis/config/crd/bases" CONTROLLER_GEN_SRC=$(CONTROLLER_GEN_SRC)

generate: generate-controller-code generate-manifests ## Generate controller code and manifests e.g. CRD etc.
generate-docs: build
HOME=${TMPDIR}/tanzu-doc-gen TANZU_CLI_CEIP_OPT_IN_PROMPT_ANSWER=no TANZU_CLI_EULA_PROMPT_ANSWER=yes TANZU_CLI_ESSENTIALS_PLUGIN_GROUP_VERSION=unused ./bin/tanzu generate-all-docs; rm -rf ${TMPDIR}/tanzu-doc-gen

generate: generate-controller-code generate-manifests generate-docs ## Generate controller code, manifests (e.g. CRD etc.) and CLI docs

## --------------------------------------
## Tooling Binaries
Expand Down Expand Up @@ -405,7 +423,7 @@ TANZU_CLI_COEXISTENCE_LEGACY_TANZU_CLI_VERSION = v0.28.1
endif

ifndef TANZU_CLI_COEXISTENCE_LEGACY_TANZU_CLI_URL
TANZU_CLI_COEXISTENCE_LEGACY_TANZU_CLI_URL = https://ent.box.com/shared/static/984uoy8mayq6rpdrfwh1omxurc0ixo57.gz # tanzu-cli-linux-amd64 v0.28.1 bundle url
TANZU_CLI_COEXISTENCE_LEGACY_TANZU_CLI_URL = https://storage.googleapis.com/tanzu-cli-installer-packages/bin/v0.28.1/tanzu-cli-linux-amd64.tar.gz # tanzu-cli-linux-amd64 v0.28.1 bundle url
endif

ifndef TANZU_CLI_CEIP_OPT_IN_PROMPT_ANSWER
Expand Down
6 changes: 3 additions & 3 deletions apis/cli/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 22 additions & 16 deletions apis/config/crd/bases/cli.tanzu.vmware.com_cliplugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.17.0
name: cliplugins.cli.tanzu.vmware.com
spec:
group: cli.tanzu.vmware.com
Expand All @@ -21,14 +20,19 @@ spec:
description: CLIPlugin denotes a Tanzu cli plugin.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
Expand Down Expand Up @@ -78,16 +82,18 @@ spec:
description: Description is the plugin's description.
type: string
optional:
description: Optional specifies whether the plugin is mandatory or
optional If optional, the plugin will not get auto-downloaded as
part of `tanzu login` or `tanzu plugin sync` command To view the
list of plugin, user can use `tanzu plugin list` and to download
a specific plugin run, `tanzu plugin install <plugin-name>`
description: |-
Optional specifies whether the plugin is mandatory or optional
If optional, the plugin will not get auto-downloaded as part of
`tanzu login` or `tanzu plugin sync` command
To view the list of plugin, user can use `tanzu plugin list` and
to download a specific plugin run, `tanzu plugin install <plugin-name>`
type: boolean
recommendedVersion:
description: Recommended version that Tanzu CLI should use if available.
The value should be a valid semantic version as defined in https://semver.org/.
E.g., 2.0.1
description: |-
Recommended version that Tanzu CLI should use if available.
The value should be a valid semantic version as defined in
https://semver.org/. E.g., 2.0.1
type: string
target:
description: Target specifies the target of the plugin. Only needed
Expand Down
2 changes: 1 addition & 1 deletion cmd/plugin/builder/command/cli_compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func setGlobals(compileArgs *PluginCompileArgs) {

// Disable function inlining to reduce binary size
disableInlining := "-gcflags=all=-l"
if len(goflags) > 0 {
if goflags != "" {
// Append the user-defined goflags so they can override the default if needed
goflags = fmt.Sprintf("%s %s", disableInlining, goflags)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y ca-certificates
sudo echo "deb https://storage.googleapis.com/tanzu-cli-os-packages/apt tanzu-cli-jessie main" | sudo tee /etc/apt/sources.list.d/tanzu.list
sudo echo "deb https://storage.googleapis.com/tanzu-cli-installer-packages/apt tanzu-cli-jessie main" | sudo tee /etc/apt/sources.list.d/tanzu.list
sudo apt-get update --allow-insecure-repositories
sudo apt-get install -y tanzu-cli --allow-unauthenticated
tanzu ceip-participation set false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build-job:
script:
- apt-get update
- apt-get install -y ca-certificates
- echo "deb https://storage.googleapis.com/tanzu-cli-os-packages/apt tanzu-cli-jessie main" | tee /etc/apt/sources.list.d/tanzu.list
- echo "deb https://storage.googleapis.com/tanzu-cli-installer-packages/apt tanzu-cli-jessie main" | tee /etc/apt/sources.list.d/tanzu.list
- apt-get update --allow-insecure-repositories
- apt-get install -y tanzu-cli --allow-unauthenticated
- tanzu ceip-participation set false
Expand Down
5 changes: 3 additions & 2 deletions docs/cli/commands/tanzu.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## tanzu


The Tanzu CLI

### Options

Expand All @@ -10,10 +10,11 @@

### SEE ALSO

* [tanzu api-token](tanzu_api-token.md) - Manage API Tokens for Tanzu Platform Self-managed
* [tanzu completion](tanzu_completion.md) - Output shell completion code
* [tanzu config](tanzu_config.md) - Configuration for the CLI
* [tanzu context](tanzu_context.md) - Configure and manage contexts for the Tanzu CLI
* [tanzu init](tanzu_init.md) - Initialize the CLI
* [tanzu login](tanzu_login.md) - Login to Tanzu Platform for Kubernetes
* [tanzu plugin](tanzu_plugin.md) - Manage CLI plugins
* [tanzu version](tanzu_version.md) - Version information

15 changes: 15 additions & 0 deletions docs/cli/commands/tanzu_api-token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## tanzu api-token

Manage API Tokens for Tanzu Platform Self-managed

### Options

```
-h, --help help for api-token
```

### SEE ALSO

* [tanzu](tanzu.md) - The Tanzu CLI
* [tanzu api-token create](tanzu_api-token_create.md) - Create a new API Token for Tanzu Platform Self-managed

29 changes: 29 additions & 0 deletions docs/cli/commands/tanzu_api-token_create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## tanzu api-token create

Create a new API Token for Tanzu Platform Self-managed

```
tanzu api-token create [flags]
```

### Examples

```

# Create an API Token for the Tanzu Platform Self-managed
tanzu api-token create

# Note: The retrieved token can be used as the value of TANZU_API_TOKEN
# environment variable when running 'tanzu login' for non-interactive workflow.
```

### Options

```
-h, --help help for create
```

### SEE ALSO

* [tanzu api-token](tanzu_api-token.md) - Manage API Tokens for Tanzu Platform Self-managed

Loading
Loading