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

[Snyk] Security upgrade setuptools from 40.5.0 to 70.0.0 #17

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
125 changes: 125 additions & 0 deletions .github/workflows/odh-build-and-publish-operator-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# This is a copy of the publish-core-images.yaml and has been customized to
# use the quay login credentials.
# The unused parts of the original have been commented out on purpose.
name: ODH

on:
- push
- pull_request

jobs:
build-and-publish-operator:
name: Build and (or) Publish Image
runs-on: ubuntu-latest
env:
GOPATH: ${{ github.workspace }}/go
REPO_NAME: ${{ vars.QUAY_REPO_NAME || 'opendatahub' }}
steps:
- name: Environment dump
shell: bash
run: |
echo "GOPATH = ${GOPATH}"
echo "REPO_NAME = ${REPO_NAME}"

- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Run go mod
shell: bash
run: |
go mod download

# Build operators inside the gh runner vm directly and then copy the go binaries to docker images using the Dockerfile.buildx
- name: Build linux/amd64 operator binary
env:
CGO_ENABLED: 1
GOOS: linux
GOARCH: amd64
shell: bash
run: |
go build -tags strictfipsruntime -a -o manager-$GOARCH cmd/training-operator.v1/main.go

- name: Build linux/arm64 operator binary
env:
CC: aarch64-linux-gnu-gcc
CGO_ENABLED: 1
GOOS: linux
GOARCH: arm64
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross
go build -tags strictfipsruntime -a -o manager-$GOARCH cmd/training-operator.v1/main.go

- name: Add docker tags
id: meta
uses: docker/metadata-action@v5
with:
images: quay.io/${{ env.REPO_NAME }}/training-operator
tags: |
type=raw,latest
type=ref,event=pr
type=sha,prefix=v1-odh-

- name: Build image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: quay.io/${{ env.REPO_NAME }}/training-operator
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
containerfiles: |
build/images/training-operator/Dockerfile.multiarch
extra-args: |
--pull

# Check if image is build
- name: Check images created
shell: bash
run: buildah images | grep 'quay.io/${{ env.REPO_NAME }}/training-operator'

- name: Check image manifest
shell: bash
run: |
buildah manifest inspect ${{ steps.build-image.outputs.image }}:latest


- name: Check image metadata
shell: bash
run: |
buildah inspect ${{ steps.build-image.outputs.image-with-tag }} | jq '.OCIv1.config.Labels."org.opencontainers.image.title"'
buildah inspect ${{ steps.build-image.outputs.image-with-tag }} | jq '.OCIv1.config.Labels."org.opencontainers.image.description"'
buildah inspect ${{ steps.build-image.outputs.image-with-tag }} | jq '.Docker.config.Labels."org.opencontainers.image.title"'
buildah inspect ${{ steps.build-image.outputs.image-with-tag }} | jq '.Docker.config.Labels."org.opencontainers.image.description"'

- name: Login to Quay.io
id: podman-login-quay
# Trigger step only for specific branch (master, v.*-branch) or tag (v.*).
if: (github.ref == 'refs/heads/dev' || (startsWith(github.ref, 'refs/heads/v') && endsWith(github.ref, '-branch')) || startsWith(github.ref, 'refs/tags/v'))
shell: bash
run: |
podman login --username ${{ secrets.QUAY_USERNAME }} --password ${{ secrets.QUAY_TOKEN }} quay.io

- name: Push to Quay.io
if: always() && steps.podman-login-quay.outcome == 'success'
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}

- name: Print image url
if: steps.push-to-quay.outcome == 'success'
shell: bash
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"

- name: Logout from Quay.io
if: always() && steps.podman-login-quay.outcome == 'success'
run: |
podman logout quay.io
7 changes: 7 additions & 0 deletions build/images/training-operator/Dockerfile.multiarch
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
ARG TARGETARCH
WORKDIR /
COPY ./manager-${TARGETARCH} ./manager
USER 65532:65532

ENTRYPOINT ["/manager"]
25 changes: 25 additions & 0 deletions build/images/training-operator/Dockerfile.rhoai
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Build the manager binary
FROM registry.access.redhat.com/ubi9/go-toolset:1.20.10 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download

# Copy the go source
COPY . .

# Build
USER root
RUN CGO_ENABLED=1 GOOS=linux GO111MODULE=on go build -tags strictfipsruntime -a -o manager cmd/training-operator.v1/main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
WORKDIR /
COPY --from=builder /workspace/manager .
USER 65532:65532
ENTRYPOINT ["/manager"]
1 change: 1 addition & 0 deletions sdk/python/kubeflow/trainer/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
peft==0.3.0
datasets==2.15.0
transformers==4.37.2
setuptools>=70.0.0 # not directly required, pinned by Snyk to avoid a vulnerability
2 changes: 2 additions & 0 deletions test/e2e/kfto_kueue_sft_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

/*
Copyright 2023.

Expand Down
Loading