Skip to content

Commit

Permalink
Merge pull request #48 from opendatahub-io/kev-test
Browse files Browse the repository at this point in the history
Kev test
  • Loading branch information
anishasthana authored Apr 6, 2024
2 parents 399c7fc + 5b82e19 commit 17d37ed
Show file tree
Hide file tree
Showing 33 changed files with 1,211 additions and 2,172 deletions.
132 changes: 0 additions & 132 deletions .github/workflows/odh-notebooks-sync.yml

This file was deleted.

104 changes: 18 additions & 86 deletions .github/workflows/project-codeflare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,9 @@ on:
replaces:
description: 'The previous operator semantic version that this release replaces (for example: v0.0.0)'
required: true
mcad-version:
description: 'Version of multi-cluster-app-dispatcher to be released (for example: v0.0.0)'
required: true
codeflare-sdk-version:
description: 'Version of CodeFlare-SDK to be released (for example: v0.0.0)'
required: true
instascale-version:
description: 'Version of InstaScale to be released (for example: v0.0.0)'
required: true
kuberay-version:
description: 'Tested version of KubeRay (for example: v0.0.0)'
required: true
Expand Down Expand Up @@ -48,78 +42,15 @@ jobs:
echo "Below are the release parameters set for the workflow:"
echo "Operator Version: ${{ github.event.inputs.operator-version }}"
echo "Replaces: ${{ github.event.inputs.replaces }}"
echo "MCAD Version: ${{ github.event.inputs.mcad-version }}"
echo "CodeFlare SDK Version: ${{ github.event.inputs.codeflare-sdk-version }}"
echo "InstaScale Version: ${{ github.event.inputs.instascale-version }}"
echo "Tested KubeRay Version: ${{ github.event.inputs.kuberay-version }}"
echo "Is Stable: ${{ github.event.inputs.is-stable }}"
echo "CodeFlare Repository Organization: ${{ github.event.inputs.codeflare-repository-organization }}"
echo "Quay Organization: ${{ github.event.inputs.quay-organization }}"
echo "Community Operators Prod Organization: ${{ github.event.inputs.community-operators-prod-organization }}"
release-mcad:
runs-on: ubuntu-latest

steps:
- name: Check if MCAD release does exist
run: |
status_code=$(curl -s -o /dev/null -w "%{http_code}" https://github.com/project-codeflare/multi-cluster-app-dispatcher/releases/tag/${{ github.event.inputs.mcad-version }})
if [[ "$status_code" == "200" ]]; then
echo "MCAD release with version ${{ github.event.inputs.mcad-version }} already exist. Will not create MCAD release."
fi
echo "MCAD_RELEASE_STATUS_CODE=$status_code" >> $GITHUB_ENV
- name: Release MCAD
run: |
gh workflow run mcad-release.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/multi-cluster-app-dispatcher --ref go-1.20 --field tag=${{ github.event.inputs.mcad-version }}
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
shell: bash
if: ${{ env.MCAD_RELEASE_STATUS_CODE != '200' }}

- name: Wait for MCAD run to finish
run: |
# wait for a while for Run to be started
sleep 5
run_id=$(gh run list --workflow mcad-release.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/multi-cluster-app-dispatcher --limit 1 --json databaseId --jq .[].databaseId)
gh run watch ${run_id} --repo ${{ github.event.inputs.codeflare-repository-organization }}/multi-cluster-app-dispatcher --interval 10 --exit-status
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
shell: bash
if: ${{ env.MCAD_RELEASE_STATUS_CODE != '200' }}

release-instascale:
needs: release-mcad
runs-on: ubuntu-latest

steps:
- name: Check if Instascale release does exist
run: |
status_code=$(curl -s -o /dev/null -w "%{http_code}" https://github.com/project-codeflare/instascale/releases/tag/${{ github.event.inputs.instascale-version }})
if [[ "$status_code" == "200" ]]; then
echo "Instascale release with version ${{ github.event.inputs.instascale-version }} already exist. Will not create Instascale release."
fi
echo "INSTASCALE_RELEASE_STATUS_CODE=$status_code" >> $GITHUB_ENV
- name: Release InstaScale
run: |
gh workflow run instascale-release.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/instascale --ref ${{ github.ref }} --field tag=${{ github.event.inputs.instascale-version }} --field mcad-version=${{ github.event.inputs.mcad-version }}
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
shell: bash
if: ${{ env.INSTASCALE_RELEASE_STATUS_CODE != '200' }}

- name: Wait for InstaScale run to finish
run: |
# wait for a while for Run to be started
sleep 5
run_id=$(gh run list --workflow instascale-release.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/instascale --limit 1 --json databaseId --jq .[].databaseId)
gh run watch ${run_id} --repo ${{ github.event.inputs.codeflare-repository-organization }}/instascale --interval 10 --exit-status
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
shell: bash
if: ${{ env.INSTASCALE_RELEASE_STATUS_CODE != '200' }}

release-codeflare-sdk:
needs: check-kuberay-version
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -152,27 +83,14 @@ jobs:
shell: bash
if: ${{ env.SDK_RELEASE_STATUS_CODE != '200' }}

- name: Sync ODH Notebooks
run: |
gh workflow run odh-notebooks-sync.yml \
--repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-operator \
--ref ${{ github.ref }} \
--field upstream-repository-organization=opendatahub-io
--field codeflare-repository-organization=${{ github.event.inputs.codeflare-repository-organization }} \
--field codeflare_sdk_release_version=${{ github.event.inputs.codeflare-sdk-version }}
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
shell: bash
if: ${{ env.SDK_RELEASE_STATUS_CODE == '200' }}

release-codeflare-operator:
needs: [release-mcad, release-instascale, release-codeflare-sdk]
needs: [release-codeflare-sdk]
runs-on: ubuntu-latest

steps:
- name: Release CodeFlare operator
run: |
gh workflow run tag-and-build.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-operator --ref ${{ github.ref }} --field is-stable=${{ github.event.inputs.is-stable }} --field version=${{ github.event.inputs.operator-version }} --field replaces=${{ github.event.inputs.replaces }} --field mcad-version=${{ github.event.inputs.mcad-version }} --field codeflare-sdk-version=${{ github.event.inputs.codeflare-sdk-version }} --field instascale-version=${{ github.event.inputs.instascale-version }} --field kuberay-version=${{ github.event.inputs.kuberay-version }} --field quay-organization=${{ github.event.inputs.quay-organization }} --field community-operators-prod-fork-organization=${{ github.event.inputs.codeflare-repository-organization }} --field community-operators-prod-organization=${{ github.event.inputs.community-operators-prod-organization }}
gh workflow run tag-and-build.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-operator --ref ${{ github.ref }} --field is-stable=${{ github.event.inputs.is-stable }} --field version=${{ github.event.inputs.operator-version }} --field replaces=${{ github.event.inputs.replaces }} --field codeflare-sdk-version=${{ github.event.inputs.codeflare-sdk-version }} --field kuberay-version=${{ github.event.inputs.kuberay-version }} --field quay-organization=${{ github.event.inputs.quay-organization }} --field community-operators-prod-fork-organization=${{ github.event.inputs.codeflare-repository-organization }} --field community-operators-prod-organization=${{ github.event.inputs.community-operators-prod-organization }}
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
shell: bash
Expand All @@ -186,3 +104,17 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
shell: bash

check-kuberay-version:
runs-on: ubuntu-latest

steps:
- name: Check if KubeRay release exists
run: |
status_code=$(curl -s -o /dev/null -w "%{http_code}" https://github.com/ray-project/kuberay/releases/tag/${{ github.event.inputs.kuberay-version }})
if [[ "$status_code" == "200" ]]; then
echo "KubeRay release with version ${{ github.event.inputs.kuberay-version }} exists and available to use."
else
echo "KubeRay release with version ${{ github.event.inputs.kuberay-version }} does not exist. Please select an existing version."
exit 1
fi
19 changes: 0 additions & 19 deletions .github/workflows/tag-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,10 @@ on:
description: 'The previous semantic version that this tag replaces.'
required: true
default: 'v0.0.0-dev'
mcad-version:
description: 'Published version of multi-cluster-app-dispatcher'
required: true
default: 'v0.0.0-dev'
codeflare-sdk-version:
description: 'Published version of CodeFlare-SDK'
required: true
default: 'v0.0.0-dev'
instascale-version:
description: 'Published version of InstaScale'
required: true
default: 'v0.0.0-dev'
kuberay-version:
description: 'Tested version of KubeRay'
required: true
Expand Down Expand Up @@ -90,18 +82,9 @@ jobs:
- name: Adjust Compatibility Matrix in readme
run: |
sed -i -E "s|(.*CodeFlare Operator.*\[).*(\].*releases/tag/).*(\).*)|\1${{ github.event.inputs.version }}\2${{ github.event.inputs.version }}\3|" README.md
sed -i -E "s|(.*Multi-Cluster App Dispatcher.*\[).*(\].*releases/tag/).*(\).*)|\1${{ github.event.inputs.mcad-version }}\2${{ github.event.inputs.mcad-version }}\3|" README.md
sed -i -E "s|(.*CodeFlare-SDK.*\[).*(\].*releases/tag/).*(\).*)|\1${{ github.event.inputs.codeflare-sdk-version }}\2${{ github.event.inputs.codeflare-sdk-version }}\3|" README.md
sed -i -E "s|(.*InstaScale.*\[).*(\].*releases/tag/).*(\).*)|\1${{ github.event.inputs.instascale-version }}\2${{ github.event.inputs.instascale-version }}\3|" README.md
sed -i -E "s|(.*KubeRay.*\[).*(\].*releases/tag/).*(\).*)|\1${{ github.event.inputs.kuberay-version }}\2${{ github.event.inputs.kuberay-version }}\3|" README.md
- name: Adjust MCAD, SDK and InstaScale dependencies in the code
run: |
sed -i -E "s/(.*MCAD_VERSION \?= ).*/\1${{ github.event.inputs.mcad-version }}/" Makefile
sed -i -E "s/(.*MCAD_REF \?= ).*/\1release-\${MCAD_VERSION}/" Makefile
sed -i -E "s/(.*INSTASCALE_VERSION \?= ).*/\1${{ github.event.inputs.instascale-version }}/" Makefile
sed -i -E "s/(.*KUBERAY_VERSION \?= ).*/\1${{ github.event.inputs.kuberay-version }}/" Makefile
- name: Update image version in params.env
run: |
VERSION=${{ github.event.inputs.version }} perl -i -pe 's/:(.*)$/:$ENV{"VERSION"}/' config/manager/params.env
Expand Down Expand Up @@ -192,8 +175,6 @@ jobs:
env:
VERSION: ${{ github.event.inputs.version }}
PREVIOUS_VERSION: ${{ github.event.inputs.replaces }}
INSTASCALE_VERSION: ${{ github.event.inputs.instascale-version }}
MCAD_VERSION: ${{ github.event.inputs.mcad-version }}
GH_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
OPERATORS_REPO_FORK_ORG: ${{ github.event.inputs.community-operators-prod-fork-organization }}
OPERATORS_REPO_ORG: ${{ github.event.inputs.community-operators-prod-organization }}
Expand Down
20 changes: 1 addition & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ PREVIOUS_VERSION ?= v0.0.0-dev
VERSION ?= v0.0.0-dev
BUNDLE_VERSION ?= $(VERSION:v%=%)

# INSTASCALE_VERSION defines the default version of the InstaScale controller
INSTASCALE_VERSION ?= v0.4.0
INSTASCALE_REPO ?= github.com/project-codeflare/instascale

# MCAD_VERSION defines the default version of the MCAD controller
MCAD_VERSION ?= v1.40.0
MCAD_REPO ?= github.com/project-codeflare/multi-cluster-app-dispatcher
# Upstream MCAD is currently only creating release tags of the form `vX.Y.Z` (i.e the version)
MCAD_CRD ?= ${MCAD_REPO}/config/crd?ref=${MCAD_VERSION}

# KUBERAY_VERSION defines the default version of the KubeRay operator (used for testing)
KUBERAY_VERSION ?= v1.0.0

Expand Down Expand Up @@ -139,9 +129,6 @@ help: ## Display this help.
.PHONY: manifests
manifests: controller-gen kustomize install-yq ## Generate RBAC objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role webhook paths="./..."
$(SED) -i -E "s|(- )\${MCAD_REPO}.*|\1\${MCAD_CRD}|" config/crd/mcad/kustomization.yaml
$(KUSTOMIZE) build config/crd/mcad | $(YQ) -s '"crd-" + .spec.names.singular' --no-doc
mv crd-*.yml config/crd

.PHONY: fmt
fmt: ## Run go fmt against code.
Expand All @@ -156,8 +143,6 @@ vet: ## Run go vet against code.

.PHONY: modules
modules: ## Update Go dependencies.
go get $(MCAD_REPO)@$(MCAD_VERSION)
go get $(INSTASCALE_REPO)@$(INSTASCALE_VERSION)
go get github.com/ray-project/kuberay/ray-operator@$(KUBERAY_VERSION)
go mod tidy

Expand All @@ -166,8 +151,6 @@ build: fmt vet ## Build manager binary.
go build \
-ldflags " \
-X 'main.OperatorVersion=$(BUILD_VERSION)' \
-X 'main.McadVersion=$(MCAD_VERSION)' \
-X 'main.InstaScaleVersion=$(INSTASCALE_VERSION)' \
-X 'main.BuildDate=$(BUILD_DATE)' \
" \
-o bin/manager main.go
Expand Down Expand Up @@ -208,7 +191,6 @@ deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in

.PHONY: undeploy
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(SED) -i -E "s|(- )\${MCAD_REPO}.*|\1\${MCAD_CRD}|" config/crd/mcad/kustomization.yaml
$(KUSTOMIZE) build config/${ENV} | kubectl delete --ignore-not-found=$(ignore-not-found) -f -
git restore config/*

Expand Down Expand Up @@ -272,7 +254,7 @@ $(YQ): $(LOCALBIN)
.PHONY: envtest
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@release-0.17

.PHONY: openshift-goimports
openshift-goimports: $(OPENSHIFT-GOIMPORTS) ## Download openshift-goimports locally if necessary.
Expand Down
Loading

0 comments on commit 17d37ed

Please sign in to comment.