Skip to content

Commit

Permalink
Added pre-commit job for cinder-operator (#35864)
Browse files Browse the repository at this point in the history
This patch adds pre-commit job for cinder
operator on prow. And also removes the make
target hooks test. As we are going to use the
new way as revive as a replacement in [1]

[1]: openstack-k8s-operators/cinder-operator#147

Signed-off-by: Amol Kahat <[email protected]>
Co-authored-by: Bhagyashri Shewale <[email protected]>
  • Loading branch information
amolkahat and bshewale authored Apr 6, 2023
1 parent 9c00e9b commit 1c47da8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 176 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ base_images:
name: "4.10"
namespace: ocp
tag: cli
golangci-lint:
name: golangci-lint
namespace: ci
tag: v1.48.0
opm-builder:
name: opm-builder
namespace: ci
Expand All @@ -30,6 +26,11 @@ images:
- destination_dir: .
source_path: /bin/opm
to: openstack-operator-ci-build-deploy
- dockerfile_literal: |
FROM src
RUN pip3 install pre-commit
from: src
to: openstack-operator-ci-pre-commit
- build_args:
- name: KUTTL_VERSION
value: v0.15.0
Expand All @@ -54,27 +55,6 @@ tests:
commands: make gotest
container:
from: src
- as: govet
commands: make govet
container:
from: src
- as: golangci
commands: |
export GOCACHE=/tmp/
export GOLANGCI_LINT_CACHE=/tmp/.cache
export GOPROXY=https://proxy.golang.org
golangci-lint run --verbose --timeout=5m0s
container:
clone: true
from: golangci-lint
- as: golint
commands: make golint
container:
from: src
- as: gofmt
commands: make gofmt || true
container:
from: src
- as: cinder-operator-build-deploy
cluster_claim:
architecture: amd64
Expand All @@ -97,6 +77,17 @@ tests:
optional: true
steps:
workflow: openstack-k8s-operators-test-build-deploy-kuttl
- as: precommit-check
commands: |
export SKIP=no-commit-to-branch
export GOFLAGS=
export PRE_COMMIT_HOME=/tmp
export GOLANGCI_LINT_CACHE=/tmp
mkdir -p ../operator && cp -r . ../operator
cd ../operator
pre-commit run --all-files --show-diff-on-failure
container:
from: openstack-operator-ci-pre-commit
zz_generated_metadata:
branch: master
org: openstack-k8s-operators
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,161 +130,20 @@ presubmits:
- ^master$
- ^master-
cluster: build05
context: ci/prow/gofmt
decorate: true
labels:
ci.openshift.io/generator: prowgen
pj-rehearse.openshift.io/can-be-rehearsed: "true"
name: pull-ci-openstack-k8s-operators-cinder-operator-master-gofmt
rerun_command: /test gofmt
spec:
containers:
- args:
- --gcs-upload-secret=/secrets/gcs/service-account.json
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
- --report-credentials-file=/etc/report/credentials
- --target=gofmt
command:
- ci-operator
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources:
requests:
cpu: 10m
volumeMounts:
- mountPath: /secrets/gcs
name: gcs-credentials
readOnly: true
- mountPath: /etc/pull-secret
name: pull-secret
readOnly: true
- mountPath: /etc/report
name: result-aggregator
readOnly: true
serviceAccountName: ci-operator
volumes:
- name: pull-secret
secret:
secretName: registry-pull-credentials
- name: result-aggregator
secret:
secretName: result-aggregator
trigger: (?m)^/test( | .* )gofmt,?($|\s.*)
- agent: kubernetes
always_run: true
branches:
- ^master$
- ^master-
cluster: build05
context: ci/prow/golangci
decorate: true
labels:
ci.openshift.io/generator: prowgen
pj-rehearse.openshift.io/can-be-rehearsed: "true"
name: pull-ci-openstack-k8s-operators-cinder-operator-master-golangci
rerun_command: /test golangci
spec:
containers:
- args:
- --gcs-upload-secret=/secrets/gcs/service-account.json
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
- --report-credentials-file=/etc/report/credentials
- --target=golangci
command:
- ci-operator
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources:
requests:
cpu: 10m
volumeMounts:
- mountPath: /secrets/gcs
name: gcs-credentials
readOnly: true
- mountPath: /etc/pull-secret
name: pull-secret
readOnly: true
- mountPath: /etc/report
name: result-aggregator
readOnly: true
serviceAccountName: ci-operator
volumes:
- name: pull-secret
secret:
secretName: registry-pull-credentials
- name: result-aggregator
secret:
secretName: result-aggregator
trigger: (?m)^/test( | .* )golangci,?($|\s.*)
- agent: kubernetes
always_run: true
branches:
- ^master$
- ^master-
cluster: build05
context: ci/prow/golint
decorate: true
labels:
ci.openshift.io/generator: prowgen
pj-rehearse.openshift.io/can-be-rehearsed: "true"
name: pull-ci-openstack-k8s-operators-cinder-operator-master-golint
rerun_command: /test golint
spec:
containers:
- args:
- --gcs-upload-secret=/secrets/gcs/service-account.json
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
- --report-credentials-file=/etc/report/credentials
- --target=golint
command:
- ci-operator
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources:
requests:
cpu: 10m
volumeMounts:
- mountPath: /secrets/gcs
name: gcs-credentials
readOnly: true
- mountPath: /etc/pull-secret
name: pull-secret
readOnly: true
- mountPath: /etc/report
name: result-aggregator
readOnly: true
serviceAccountName: ci-operator
volumes:
- name: pull-secret
secret:
secretName: registry-pull-credentials
- name: result-aggregator
secret:
secretName: result-aggregator
trigger: (?m)^/test( | .* )golint,?($|\s.*)
- agent: kubernetes
always_run: true
branches:
- ^master$
- ^master-
cluster: build05
context: ci/prow/govet
context: ci/prow/images
decorate: true
labels:
ci.openshift.io/generator: prowgen
pj-rehearse.openshift.io/can-be-rehearsed: "true"
name: pull-ci-openstack-k8s-operators-cinder-operator-master-govet
rerun_command: /test govet
name: pull-ci-openstack-k8s-operators-cinder-operator-master-images
rerun_command: /test images
spec:
containers:
- args:
- --gcs-upload-secret=/secrets/gcs/service-account.json
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
- --report-credentials-file=/etc/report/credentials
- --target=govet
- --target=[images]
command:
- ci-operator
image: ci-operator:latest
Expand All @@ -311,27 +170,27 @@ presubmits:
- name: result-aggregator
secret:
secretName: result-aggregator
trigger: (?m)^/test( | .* )govet,?($|\s.*)
trigger: (?m)^/test( | .* )images,?($|\s.*)
- agent: kubernetes
always_run: true
branches:
- ^master$
- ^master-
cluster: build05
context: ci/prow/images
context: ci/prow/precommit-check
decorate: true
labels:
ci.openshift.io/generator: prowgen
pj-rehearse.openshift.io/can-be-rehearsed: "true"
name: pull-ci-openstack-k8s-operators-cinder-operator-master-images
rerun_command: /test images
name: pull-ci-openstack-k8s-operators-cinder-operator-master-precommit-check
rerun_command: /test precommit-check
spec:
containers:
- args:
- --gcs-upload-secret=/secrets/gcs/service-account.json
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
- --report-credentials-file=/etc/report/credentials
- --target=[images]
- --target=precommit-check
command:
- ci-operator
image: ci-operator:latest
Expand All @@ -358,7 +217,7 @@ presubmits:
- name: result-aggregator
secret:
secretName: result-aggregator
trigger: (?m)^/test( | .* )images,?($|\s.*)
trigger: (?m)^/test( | .* )precommit-check,?($|\s.*)
- agent: kubernetes
always_run: true
branches:
Expand Down

0 comments on commit 1c47da8

Please sign in to comment.