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

[pull] main from opendatahub-io:main #3

Merged
merged 7 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
67 changes: 67 additions & 0 deletions .github/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
ARG CI_BASE=registry.access.redhat.com/ubi8

FROM ${CI_BASE} as stage1

ARG GOLANGCI_LINT_VERSION=1.51.1
ARG REVIVE_VERSION=v1.2.5
ARG STATICCHECK_VERSION=v0.3.3
ARG INEFFASSIGN_VERSION=13ace05
ARG ERRCHECK_VERSION=v1.6.3
ARG GHCLI_VERSION=2.23.0

ENV GOPATH=/build \
GO111MODULE=on \
PATH=/build/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

WORKDIR /build/src

RUN dnf -y install \
golang \
git

RUN go install github.com/mgechev/revive@${REVIVE_VERSION}
RUN go install honnef.co/go/tools/cmd/staticcheck@${STATICCHECK_VERSION}
RUN go install github.com/gordonklaus/ineffassign@${INEFFASSIGN_VERSION}
RUN go install github.com/kisielk/errcheck@${ERRCHECK_VERSION}

RUN curl -L -o /tmp/golangci-lint.tar.gz \
https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz
RUN tar -C /tmp -xv --strip-components=1 -f /tmp/golangci-lint.tar.gz && \
cp /tmp/golangci-lint /build/bin/

RUN curl -L -o /tmp/ghcli.tar.gz https://github.com/cli/cli/releases/download/v${GHCLI_VERSION}/gh_${GHCLI_VERSION}_linux_amd64.tar.gz
RUN tar -C /tmp -xv --strip-components=1 -f /tmp/ghcli.tar.gz && \
cp /tmp/bin/gh /build/bin/

FROM ${CI_BASE}

ENV SUMMARY="Toolchain for running pre-commit hooks." \
DESCRIPTION="Toolchain for running pre-commit hooks." \
PATH=/build/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
GO111MODULE=on

LABEL summary="$SUMMARY" \
description="$DESCRIPTION" \
io.k8s.description="$DESCRIPTION" \
io.k8s.display-name="Pre-Commit Toolchain" \
io.openshift.tags="pre-commit"

COPY --from=stage1 /build/bin /build/bin

RUN dnf -y install \
python39 \
python3-pip \
golang \
git \
make \
&& \
dnf clean all

WORKDIR /build/src

COPY requirements.txt /tmp/requirements.txt
RUN python3 -m venv /build

RUN . /build/bin/activate && \
python3 -m pip install -U pip && \
python3 -m pip install -r /tmp/requirements.txt
12 changes: 12 additions & 0 deletions .github/build/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[requires]
python_version = "3.9.16"

[packages]
pre-commit = "~=2.17.0"
138 changes: 138 additions & 0 deletions .github/build/Pipfile.lock

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

4 changes: 4 additions & 0 deletions .github/build/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Pre-Commit Go Toolchain

The artifacts in this folder are used for running pre-commit CI against Pull Requests in this repo. For the pre-commit
configuration, see the `.github/workflows` directory.
18 changes: 18 additions & 0 deletions .github/build/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# These requirements were autogenerated by pipenv
# To regenerate from the project's Pipfile, run:
#
# pipenv lock --requirements
#

-i https://pypi.org/simple
cfgv==3.3.1; python_full_version >= '3.6.1'
distlib==0.3.6
filelock==3.9.0; python_version >= '3.7'
identify==2.5.17; python_version >= '3.7'
nodeenv==1.7.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'
platformdirs==3.0.0; python_version >= '3.7'
pre-commit==2.17.0
pyyaml==6.0; python_version >= '3.6'
toml==0.10.2; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'
virtualenv==20.19.0; python_version >= '3.7'
33 changes: 33 additions & 0 deletions .github/workflows/precommit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Pre-commit
on:
push:
branches:
- '**'
tags-ignore:
- 'v*'
pull_request:
workflow_dispatch:

jobs:
precommit:
runs-on: ubuntu-latest
container:
image: quay.io/opendatahub/pre-commit-go-toolchain:v0.1
env:
XDG_CACHE_HOME: /cache
GOCACHE: /cache/go-build
GOMODCACHE: /cache/go-mod
PRE_COMMIT_HOME: /cache/pre-commit
volumes:
- /cache
steps:
- uses: actions/checkout@v2

- name: Activate cache
uses: actions/cache@v2
with:
path: /cache
key: ${{ runner.os }}-cache-${{ hashFiles('**/go.sum', '.pre-commit-config.yaml') }}

- name: Run pre-commit checks
run: pre-commit run --all-files
12 changes: 12 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
run:
timeout: 5m
linters:
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
- revive
30 changes: 30 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
hooks:
- id: trailing-whitespace
exclude: README.md
- id: check-merge-conflict
- id: end-of-file-fixer
- id: check-added-large-files
- id: check-case-conflict
- id: check-json
- id: check-symlinks
- id: detect-private-key

- repo: https://github.com/adrienverge/yamllint.git
rev: v1.25.0
hooks:
- id: yamllint
files: \.(yaml|yml)$
types: [file, yaml]
entry: yamllint --strict

- repo: https://github.com/dnephin/pre-commit-golang
rev: c17f835cf9
hooks:
- id: go-fmt
- id: golangci-lint
- id: go-unit-tests
- id: go-build
- id: go-mod-tidy
11 changes: 11 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
extends: default
rules:
line-length: disable
document-start: disable
indentation:
indent-sequences: whatever
comments-indentation: disable
hyphens:
max-spaces-after: 4
truthy:
check-keys: false
1 change: 1 addition & 0 deletions OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ reviewers:
- DharmitD
- gmfrasca
- gregsheremeta
- harshad16
- HumairAK
- rimolive
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ oc delete project ${DSP_Namespace_2}
cd ${REPO}/config/default
kustomize build . | oc delete -f -
oc delete project ds-pipelines-controller
```
```
2 changes: 1 addition & 1 deletion config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resources:
- bases/dspipelines.opendatahub.io_dspipelines.yaml
#+kubebuilder:scaffold:crdkustomizeresource
# +kubebuilder:scaffold:crdkustomizeresource
- bases/scheduledworkflows.yaml
- bases/viewers.yaml

Expand Down
1 change: 0 additions & 1 deletion config/prometheus/monitor.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Prometheus Monitor Service (Metrics)
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
Expand Down
20 changes: 10 additions & 10 deletions config/samples/dspipelines.io_v1alpha1_dspipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ spec:
image: quay.io/opendatahub/odh-ml-pipelines-frontend-container:beta-ui
configMap: ds-pipeline-ui-configmap
database:
mariaDB: # mutually exclusive with custom
mariaDB: # mutually exclusive with custom
image: registry.redhat.io/rhel8/mariadb-103:1-188
username: mlpipeline
pipelineDBName: randomDBName
passwordSecret:
name: ds-pipelines-db-sample
key: password
# customDB:
# host: mysql:3306
# port: "8888"
# username: root
# pipelineDBName: randomDBName
# passwordSecret:
# name: somesecret
# key: somekey
# customDB:
# host: mysql:3306
# port: "8888"
# username: root
# pipelineDBName: randomDBName
# passwordSecret:
# name: somesecret
# key: somekey
storage:
minio: # mutually exclusive with custom
minio: # mutually exclusive with custom
image: quay.io/opendatahub/minio:RELEASE.2019-08-14T20-37-41Z-license-compliance
bucket: mlpipeline
s3CredentialsSecret:
Expand Down
Loading