Skip to content

Commit

Permalink
Merge pull request #68 from rawlingsj/master
Browse files Browse the repository at this point in the history
upgrade kubernetes deps to 0.19.2, use golang 1.15, remove old APIs, add semver 3
  • Loading branch information
jenkins-x-bot authored Oct 2, 2020
2 parents 23920f9 + 1622e79 commit 6315fd7
Show file tree
Hide file tree
Showing 522 changed files with 32,542 additions and 29,980 deletions.
56 changes: 3 additions & 53 deletions Makefile.codegen
Original file line number Diff line number Diff line change
@@ -1,63 +1,13 @@
CODE_GEN_BIN_NAME := codegen
CODE_GEN_GO_DEPENDENCIES := $(call rwildcard,cmd/codegen/,*.go)
CODE_GEN_BUILDFLAGS :=
ifdef DEBUG
CODE_GEN_BUILDFLAGS := -gcflags "all=-N -l" $(CODE_GEN_BUILDFLAGS)
endif

PEGOMOCK_VERSION := v2.7.0
CLIENTSET_GENERATOR_VERSION := kubernetes-1.15.12
GEN_APIDOCS_VERSION := v0.0.0-20190912061656-a61bc210ee54
OPENAPI_GEN_VERSION := 36ebc4887cdc

build-codegen: build/$(CODE_GEN_BIN_NAME) ## Build the code generator

build/$(CODE_GEN_BIN_NAME): $(CODE_GEN_GO_DEPENDENCIES)
CGO_ENABLED=$(CGO_ENABLED) $(GO) build $(CODE_GEN_BUILDFLAGS) -o build/$(CODE_GEN_BIN_NAME) cmd/codegen/codegen.go

test-codegen: ## Test the code geneator
CGO_ENABLED=$(CGO_ENABLED) $(GO) test -v -short ./cmd/codegen/...
CLIENTSET_GENERATOR_VERSION := kubernetes-1.19.2

# Generate go code using generate directives in files and kubernetes code generation
# Anything generated by this target should be checked in
generate: build-codegen install-generate-deps generate-mocks generate-openapi generate-client ## Generate the Go code (crds, mocks, openapi, client)
generate: ## Generate the Go code (crds, mocks, openapi, client)
./hack/update-codegen.sh
@$(MAKE) fmt
@$(MAKE) importfmt
@echo "Generation complete"

install-generate-deps:
$(GO) get github.com/petergtz/pegomock/...@$(PEGOMOCK_VERSION)

generate-mocks: install-generate-deps go-generate fmt importfmt ## Generate the mocks

go-generate:
@echo "Generating Mocks using pegomock"
$(GO) generate ./...

generate-client: codegen-clientset codegen-config fmt importfmt ## Generate the client

codegen-clientset: build-codegen ## Generate the k8s types and clients
# sleep for one second to prevent collision with previous codegen's replacement of go.mod
sleep 1
@echo "Generating Kubernetes Clients for pkg/apis in pkg/client for jenkins.io:v1"
./build/$(CODE_GEN_BIN_NAME) --generator-version $(CLIENTSET_GENERATOR_VERSION) clientset --output-package=pkg/client --input-package=pkg/apis --group-with-version=jenkins.io:v1

codegen-config: build-codegen ## Generate the deepcopy for the config, jenkinsfile, and tekton/syntax packages
# sleep for one second to prevent collision with previous codegen's replacement of go.mod
sleep 1
./build/$(CODE_GEN_BIN_NAME) --generator-version $(CLIENTSET_GENERATOR_VERSION) clientset --generator deepcopy --output-package=pkg --input-package=pkg --group-with-version=config:

# Generated docs are not checked in
generate-docs: build-codegen ## Generate the docs
@echo "Generating HTML docs for Kubernetes Clients"
./build/$(CODE_GEN_BIN_NAME) --generator-version $(GEN_APIDOCS_VERSION) docs

generate-openapi: codegen-openapi fmt importfmt

codegen-openapi: build-codegen
@echo "Generating OpenAPI structs for Kubernetes Clients"
./build/$(CODE_GEN_BIN_NAME) --generator-version $(OPENAPI_GEN_VERSION) openapi --output-package=pkg/client --input-package=github.com/jenkins-x/jx-api/pkg/apis --group-with-version=jenkins.io:v1 --version=1.0 --module-name=github.com/jenkins-x/jx-api

install-refdocs:
$(GO) get github.com/jenkins-x/gen-crd-api-reference-docs

Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
# jx-api

[![Documentation](https://godoc.org/github.com/jenkins-x/jx-api?status.svg)](https://pkg.go.dev/mod/github.com/jenkins-x/jx-api)
[![Go Report Card](https://goreportcard.com/badge/github.com/jenkins-x/jx-api)](https://goreportcard.com/report/github.com/jenkins-x/jx-api)
[![Releases](https://img.shields.io/github/release-pre/jenkins-x/jx-api.svg)](https://github.com/jenkins-x/jx-api/releases)
[![LICENSE](https://img.shields.io/github/license/jenkins-x/jx-api.svg)](https://github.com/jenkins-x/jx-api/blob/master/LICENSE)
[![Slack Status](https://img.shields.io/badge/slack-join_chat-white.svg?logo=slack&style=social)](https://slack.k8s.io/)

Provides an API for JX, can be used with [Jenkins X Kube Client](https://github.com/jenkins-x/jx-kube-client) to create
a programatic interface

Here's an example which also uses [Jenkins X logging](https://github.com/jenkins-x/jx-logging)

```go
import (
"github.com/jenkins-x/jx-kube-client/pkg/kubeclient"
"github.com/jenkins-x/jx-logging/pkg/log"
"github.com/jenkins-x/jx-api/pkg/client/clientset/versioned"
"github.com/jenkins-x/jx-kube-client/v3/pkg/kubeclient"
"github.com/jenkins-x/jx-logging/v3/pkg/log"
"github.com/jenkins-x/jx-api/v3/pkg/client/clientset/versioned"
)

func main() {
Expand Down
3 changes: 3 additions & 0 deletions cmd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The code-generator dir in this folder is a copy from https://github.com/kubernetes/code-generator

Note code-generator is not a clone as we couldn't get gitsubmodules playing nice with the ./hack/generate.sh step in CI
2 changes: 2 additions & 0 deletions cmd/code-generator/.github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Sorry, we do not accept changes directly against this repository. Please see
CONTRIBUTING.md for information on where and how to contribute instead.
7 changes: 7 additions & 0 deletions cmd/code-generator/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Contributing guidelines

Do not open pull requests directly against this repository, they will be ignored. Instead, please open pull requests against [kubernetes/kubernetes](https://git.k8s.io/kubernetes/). Please follow the same [contributing guide](https://git.k8s.io/kubernetes/CONTRIBUTING.md) you would follow for any other pull request made to kubernetes/kubernetes.

This repository is published from [kubernetes/kubernetes/staging/src/k8s.io/code-generator](https://git.k8s.io/kubernetes/staging/src/k8s.io/code-generator) by the [kubernetes publishing-bot](https://git.k8s.io/publishing-bot).

Please see [Staging Directory and Publishing](https://git.k8s.io/community/contributors/devel/sig-architecture/staging.md) for more information
206 changes: 206 additions & 0 deletions cmd/code-generator/Godeps/Godeps.json

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

4 changes: 4 additions & 0 deletions cmd/code-generator/Godeps/OWNERS

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

5 changes: 5 additions & 0 deletions cmd/code-generator/Godeps/Readme

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

Loading

0 comments on commit 6315fd7

Please sign in to comment.