Skip to content

Commit

Permalink
Genjobs: update docs, create Dockerfile, and make go submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Clarke committed Nov 28, 2019
1 parent 5971f38 commit 25f0db4
Show file tree
Hide file tree
Showing 8 changed files with 766 additions and 18 deletions.
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ require (
github.com/kr/pretty v0.1.0
github.com/prometheus/client_golang v1.2.1
github.com/sirupsen/logrus v1.4.2
github.com/spf13/pflag v1.0.5
golang.org/x/net v0.0.0-20191021144547-ec77196f6094
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
Expand All @@ -28,5 +27,4 @@ require (
k8s.io/apimachinery v0.0.0-20190817020851-f2f3a405f61d
k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible
k8s.io/test-infra v0.0.0-20191126210720-282e49f14e7a
sigs.k8s.io/yaml v1.1.0
)
3 changes: 0 additions & 3 deletions prow/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ CLUSTER_BUILD ?= prow
CLUSTER_PRIVATE ?= prow-private
ZONE ?= us-west1-a

gen-private-jobs:
@./genjobs/gen-private-jobs.sh

update-config-dry-run: get-cluster-credentials
./recreate_prow_configmaps.py \
--job-config-dir=cluster/jobs \
Expand Down
13 changes: 13 additions & 0 deletions prow/genjobs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM golang:1.13 as build-env

WORKDIR /go/src/genjobs

COPY . /go/src/genjobs

RUN go build -o /go/bin/genjobs

FROM gcr.io/distroless/base:22bd467b41e5e656e31db347265fae118db166d9

COPY --from=build-env /go/bin/genjobs /

ENTRYPOINT ["/genjobs"]
33 changes: 33 additions & 0 deletions prow/genjobs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2019 Istio 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.

PROJECT = istio-testing
HUB = gcr.io
VERSION ?= 0.0.1

.PHONY: deploy
deploy: image push

.PHONY: gen-private-jobs
gen-private-jobs:
@./gen-private-jobs.sh

.PHONY: image
image:
docker build -t "$(HUB)/$(PROJECT)/genjobs:$(VERSION)" -t "$(HUB)/$(PROJECT)/genjobs:latest" .

.PHONY: push
push:
docker push "$(HUB)/$(PROJECT)/genjobs:$(VERSION)"
docker push "$(HUB)/$(PROJECT)/genjobs:latest"
31 changes: 29 additions & 2 deletions prow/genjobs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,39 @@

## Installation

Install using Golang:

```console
$ GO111MODULE="on" go get -u istio.io/test-infra/prow/genjobs
```

Install using Docker:

```console
$ go get -u istio.io/test-infra/prow/genjobs
$ docker pull gcr.io/istio-testing/genjobs:latest
```

Install from source:

```console
$ git clone https://github.com/istio/test-infra.git
$ cd ./test-infra/prow/genjobs/
$ go install
```

## Usage

Run using Golang:
> Ensure `$GOPATH/bin` is on your `$PATH`; or execute `$GOPATH/bin/genjobs` directly.
```console
$ go run istio.io/test-infra/prow/genjobs <options>
$ genjobs <options>
```

Run using Docker:

```console
$ docker run gcr.io/istio-testing/genjobs:latest <options>
```

The following is a list of supported options for `genjobs`. The only **required** option is `-m, --mapping`, which is the translation mapping between public/private Github organizations.
Expand Down Expand Up @@ -102,3 +125,7 @@ Delete jobs in destination path prior to generation:
```console
$ genjobs --mapping istio=istio-private --clean
```

## Changelog

- 0.0.1: initial release
22 changes: 11 additions & 11 deletions prow/genjobs/gen-private-jobs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ COMMON_OPTS=(
)

# Clean ./prow/cluster/jobs/istio-private directory
go run ./genjobs --clean --mapping=istio=istio-private --output=./cluster/jobs/ --dry-run >/dev/null
go run . --clean --mapping=istio=istio-private --output=./cluster/jobs/ --dry-run >/dev/null

# istio/istio build job(s) - postsubmit(s)
go run ./genjobs \
go run . \
"${COMMON_OPTS[@]}" \
--branches=release-1.4,master \
--env DOCKER_HUB=gcr.io/istio-prow-build,GCS_BUCKET=istio-private-build/dev \
Expand All @@ -44,15 +44,15 @@ go run ./genjobs \
--job-whitelist release_istio_postsubmit,release_istio_release-1.4_postsubmit

# istio/istio test jobs(s) - presubmit(s) and postsubmit(s)
go run ./genjobs \
go run . \
"${COMMON_OPTS[@]}" \
--branches=release-1.4,master \
--job-type presubmit,postsubmit \
--repo-whitelist istio \
--job-blacklist release_istio_postsubmit,release_istio_release-1.4_postsubmit

# istio/proxy master test jobs(s) - presubmit(s)
go run ./genjobs \
go run . \
"${COMMON_OPTS[@]}" \
--branches master \
--modifier=master_priv \
Expand All @@ -62,7 +62,7 @@ go run ./genjobs \
--repo-whitelist proxy

# istio/proxy master build jobs(s) - postsubmit(s)
go run ./genjobs \
go run . \
"${COMMON_OPTS[@]}" \
--branches master \
--modifier master_priv \
Expand All @@ -72,7 +72,7 @@ go run ./genjobs \
--repo-whitelist proxy

# istio/proxy release-1.4 test jobs(s) - presubmit(s)
go run ./genjobs \
go run . \
"${COMMON_OPTS[@]}" \
--branches release-1.4 \
--modifier release-1.4_priv \
Expand All @@ -82,7 +82,7 @@ go run ./genjobs \
--repo-whitelist proxy

# istio/proxy release-1.4 build jobs(s) - postsubmit(s)
go run ./genjobs \
go run . \
"${COMMON_OPTS[@]}" \
--branches release-1.4 \
--modifier=release-1.4_priv \
Expand All @@ -92,23 +92,23 @@ go run ./genjobs \
--repo-whitelist proxy

# istio/release-builder master test jobs(s) - pre/postsubmit(s)
go run ./genjobs \
go run . \
"${COMMON_OPTS[@]}" \
--branches=master \
--job-type presubmit,postsubmit \
--repo-whitelist release-builder \
--job-whitelist lint_release-builder,lint_release-builder_postsubmit,test_release-builder,test_release-builder_postsubmit,gencheck_release-builder,gencheck_release-builder_postsubmit

# istio/release-builder release-1.4 test jobs(s) - pre/postsubmit(s)
go run ./genjobs \
go run . \
"${COMMON_OPTS[@]}" \
--branches=release-1.4 \
--job-type presubmit,postsubmit \
--repo-whitelist release-builder \
--job-whitelist lint_release-builder_release-1.4,lint_release-builder_release-1.4_postsubmit,test_release-builder_release-1.4,test_release-builder_release-1.4_postsubmit,gencheck_release-builder_release-1.4,gencheck_release-builder_release-1.4_postsubmit

# istio/release-builder build warning jobs(s) - presubmit(s)
go run ./genjobs \
go run . \
"${COMMON_OPTS[@]}" \
--branches=release-1.4,master \
--env PRERELEASE_DOCKER_HUB=gcr.io/istio-prow-build,GCS_BUCKET=istio-private-prerelease/prerelease \
Expand All @@ -117,7 +117,7 @@ go run ./genjobs \
--job-whitelist build-warning_release-builder,build-warning_release-builder_release-1.4

# istio/release-builder build jobs(s) - postsubmit(s)
go run ./genjobs \
go run . \
"${COMMON_OPTS[@]}" \
--branches=release-1.4,master \
--labels preset-override-envoy=true,preset-override-deps=release-1.4 \
Expand Down
14 changes: 14 additions & 0 deletions prow/genjobs/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module istio.io/test-infra/prow/genjobs

go 1.13

replace k8s.io/client-go => k8s.io/client-go v0.0.0-20190918200256-06eb1244587a

require (
github.com/spf13/pflag v1.0.5
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 // indirect
k8s.io/api v0.0.0-20190918195907-bd6ac527cfd2
k8s.io/apimachinery v0.0.0-20190817020851-f2f3a405f61d
k8s.io/test-infra v0.0.0-20191128022303-0a9f4b1a27b0
sigs.k8s.io/yaml v1.1.0
)
Loading

0 comments on commit 25f0db4

Please sign in to comment.