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

Bump odh 0.12.rc0 to rhoai main branch #10

Merged
merged 33 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
35dcc34
[RHODS-12555] - CVE-2023-44487
spolti Oct 18, 2023
4c5fb80
Merge pull request #20 from spolti/RHODS-12555
openshift-ci[bot] Oct 20, 2023
36cb079
chore: Add CodeQL configuration (#29)
ckadner Oct 30, 2023
7b8af3d
fix: Specify Python 3.8 in Dockerfile (#34)
rafvasq Nov 17, 2023
7d17855
fix: Specify Python 3.8 in Dockerfile (#34)
rafvasq Nov 17, 2023
b30e426
Merge pull request #25 from spolti/fixCi
openshift-merge-bot[bot] Nov 22, 2023
e499d5d
Fix github.com/elazarl/goproxy Denial of Service
spolti Nov 21, 2023
09e54c6
Merge pull request #24 from spolti/goproxy
openshift-merge-bot[bot] Nov 22, 2023
e2857ff
chore(deps): Upgrade golang.org/x/net and golang.org/grpc (#30)
spolti Nov 23, 2023
61dc700
chore: Upgrade Golang version from 1.18 to 1.19 (#28)
spolti Nov 30, 2023
2f63e34
chore: Upgrade google.golang.org/protobuf
spolti Jan 10, 2024
513a3f2
chore: Upgrade golang.org/x/crypto (#36)
spolti Jan 10, 2024
918f79c
[RHODS-12555] - CVE-2023-44487
spolti Oct 18, 2023
da70aa6
fix: Specify Python 3.8 in Dockerfile (#34)
rafvasq Nov 17, 2023
a485071
Fix github.com/elazarl/goproxy Denial of Service
spolti Nov 21, 2023
c750c98
chore: Add CodeQL configuration (#29)
ckadner Oct 30, 2023
11c52d0
chore(deps): Upgrade golang.org/x/net and golang.org/grpc (#30)
spolti Nov 23, 2023
2884d60
chore: Upgrade Golang version from 1.18 to 1.19 (#28)
spolti Nov 30, 2023
bd494fe
chore: Upgrade google.golang.org/protobuf
spolti Jan 10, 2024
51ba6d1
chore: Upgrade golang.org/x/crypto (#36)
spolti Jan 10, 2024
6d147f8
Merge branch 'main' into sync
spolti Jan 10, 2024
b8ecd15
Merge pull request #26 from spolti/sync
openshift-merge-bot[bot] Jan 10, 2024
066ed25
Update OWNERS
heyselbi Feb 14, 2024
ed6f3d2
Merge pull request #34 from heyselbi/main
openshift-merge-bot[bot] Feb 14, 2024
4d8e991
chore: Make the builder configurable in the Makefile (#35)
spolti Mar 13, 2024
050bcb5
Merge branch 'upstream main' into odh main
spolti Mar 14, 2024
6c74cb0
Merge pull request #37 from spolti/sync1
openshift-merge-bot[bot] Mar 15, 2024
9ce55d4
chore: update google.golang.org/protobuf to v1.33.0 (#40)
israel-hdez Mar 20, 2024
79bd03b
Add Tag and Release workflow
rpancham Apr 18, 2024
2389140
Merge pull request #42 from rpancham/tagrversion
openshift-merge-bot[bot] Apr 18, 2024
c5a4f74
chore: Update golang.org/x/net (#41)
spolti Apr 18, 2024
61eb922
Merge pull request #39 from kserve/main
openshift-merge-bot[bot] Apr 18, 2024
975bbc7
Merge branch 'odh_0.12.0-rc0' into 0.12.rc0-sync
invalid-email-address May 21, 2024
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
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.env
.dockerignore
.vscode
.DS_Store
Dockerfile
temp
.pre-commit.log

81 changes: 81 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
schedule:
- cron: "15 8 * * *"

jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ["go"]
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
82 changes: 82 additions & 0 deletions .github/workflows/create-tag-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Create Tag and Release changelog

on:
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for the new release'
required: true

permissions:
contents: write
packages: write
pull-requests: write

jobs:
fetch-tag:
runs-on: ubuntu-latest
outputs:
old_tag: ${{ steps.get_tag.outputs.old_tag_name }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0

- name: Get latest tag
id: get_tag
run: |
echo "old_tag_name=$(git ls-remote --tags origin | awk -F'/' '{print $3}' | grep -v '{}' | sort -V | tail -n1)" >> $GITHUB_OUTPUT

- name: print tag
id: print_tag
run: |
echo "Old Tag=${{ steps.get_tag.outputs.old_tag_name }}"
echo "NEW_TAG=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
echo "$(basename ${{ github.ref }})"

- name: Check if tag exists
id: check_tag
run: |
import sys
import subprocess
tag_name = "${{ github.event.inputs.tag_name }}"
command = ['git', 'tag', '-l', tag_name]
output = subprocess.check_output(command, stderr=subprocess.STDOUT)
if output.decode() != "":
print(f"Error: Tag '{tag_name}' already exists.", file=sys.stderr)
sys.exit(1)
else:
print(f"Tag '{tag_name}' does not exists.")
shell: python
continue-on-error: false

- name: Create Tag
id: create_tag
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git tag -a ${{ github.event.inputs.tag_name }} -m "Prepare for ODH release ${{ github.event.inputs.tag_name }}"
git push origin ${{ github.event.inputs.tag_name }}

changelog:
name: Changelog
needs: fetch-tag
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- name: Create Release
uses: softprops/action-gh-release@v2
with:
token: ${{ github.token }}
tag_name: ${{ github.event.inputs.tag_name }}
prerelease: false
draft: false
files: bin/*
generate_release_notes: true
name: ${{ github.event.inputs.tag_name }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ google/

# IDE
.idea/

.pre-commit.log

2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ repos:
rev: v1.51.1
hooks:
- id: golangci-lint
log_file: .pre-commit.log
entry: golangci-lint run
exclude: ^(gen/)
args:
Expand All @@ -24,6 +25,7 @@ repos:
rev: v2.4.1
hooks:
- id: prettier
log_file: .pre-commit.log
exclude: ^(.github/)
args:
- --no-bracket-spacing
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ RUN true \
COPY .pre-commit-config.yaml ./
RUN git init && \
pre-commit install-hooks && \
git config --global --add safe.directory "*" && \
rm -rf .git

# Download dependencies before copying the source so they will be cached
Expand Down
14 changes: 8 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
# limitations under the License.

IMG_NAME ?= kserve/rest-proxy
# make builder configurable, default to docker.
ENGINE ?= docker

# collect args from `make run` so that they don't run twice
ifeq (run,$(firstword $(MAKECMDGOALS)))
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
ifneq ("$(wildcard /.dockerenv)","")
$(error Inside docker container, run 'make $(RUN_ARGS)')
$(error Inside the developer container, run 'make $(RUN_ARGS)')
endif
endif

Expand All @@ -36,24 +38,24 @@ google/api/%.proto:
@test -f $@ || wget --inet4-only -q -O $@ https://raw.githubusercontent.com/googleapis/googleapis/master/$@

.PHONY: build
## Build runtime Docker image
## Build runtime container image
build:
docker build -t ${IMG_NAME}:latest --target runtime .
${ENGINE} build -t ${IMG_NAME}:latest --target runtime .

.PHONY: build.develop
## Build develop container image
build.develop:
docker build -t ${IMG_NAME}-develop:latest --target develop .
${ENGINE} build -t ${IMG_NAME}-develop:latest --target develop .

.PHONY: develop
## Run interactive shell inside developer container
develop: build.develop
./scripts/develop.sh
ENGINE=${ENGINE} && ./scripts/develop.sh

.PHONY: run
## Run make target inside developer container (e.g. `make run fmt`)
run: build.develop
./scripts/develop.sh make $(RUN_ARGS)
ENGINE=${ENGINE} && ./scripts/develop.sh make $(RUN_ARGS)

.PHONY: fmt
## Auto-format source code and report code-style violations (lint)
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,21 @@ all the required libraries pre-installed.
make run generate
```

### Build the Docker image
### Build the Container image

After regenerating the gRPC gateway stubs, rebuild the `rest-proxy` Docker image.

```bash
make build
```

### Push the Docker image
If you need to use another builder than `docker`, you can specify it by using the `ENGINE` variable:

```bash
ENGINE=podman make build
```

### Push the Container image

Before pushing the new `rest-proxy` image to your container registry, re-tag the
image created by `make build` in the step above.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/google/go-cmp v0.5.9
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0
google.golang.org/grpc v1.56.3
google.golang.org/protobuf v1.32.0
google.golang.org/protobuf v1.33.0
sigs.k8s.io/controller-runtime v0.14.1
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc=
google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
2 changes: 1 addition & 1 deletion scripts/develop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ else
fi

# Run the develop container with local source mounted in
docker run --rm \
${ENGINE:-docker} run --rm \
"${docker_run_args[@]}" \
kserve/rest-proxy-develop:latest "$@"
6 changes: 3 additions & 3 deletions scripts/fmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# 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.#
# limitations under the License.

# Fix: 'fatal: detected dubious ownership in repository',
# only do this if it is running into the develop image
Expand All @@ -22,8 +22,8 @@ fi
pre-commit run --all-files
RETURN_CODE=$?
## cat this file for helping on identifying the root cause when some issue happens
if [ -f /$USER/.cache/pre-commit/pre-commit.log ]; then
cat /$USER/.cache/pre-commit/pre-commit.log
if [ -f .pre-commit.log ]; then
cat .pre-commit.log
fi

function echoError() {
Expand Down
Loading