Skip to content

Latest commit

 

History

History
85 lines (79 loc) · 2.53 KB

README.md

File metadata and controls

85 lines (79 loc) · 2.53 KB

Image Build Tracking on Openshift Platform


Benchmark Spec

Define list of build resource to track with trackBuildConfigs key

  trackBuildConfigs:
  - kind: [buildconfig kind]
    name: [buildconfig name]
    namespace: [buildconfig namespace]

BuildWatcher

  • BuildWatcher watch UpdateEvent of build.openshift.io/v1/builds wait for first-time status.phase=Complete
  • BuildWatcher match status.configs to cpe.cogadvisor.io/v1/benchmarks
  • BuildWatcher update buildname to status.trackedBuilds list cpe.cogadvisor.io/v1/benchmarks
  • BenchmarkController get Update request of cpe.cogadvisor.io/v1/benchmarks
  • BenchmarkController add new job according to operator attached with the build name

Ray Image Build Example:

1. Prepare source repo

reference

  • fork ray-project/ray to ray-repo-clone
  • add {{ .Values.operatorNamespace }} to template
  • add securityContext.privileged
  • run
    cd ray
    helm package .
    helm repo index . --url https://github.com/raw/sunya-ch/ray-repo-clone/master/deploy/charts/ray
    git add .
    git commit -m "index helm"
    git push git@github.com:sunya-ch/ray-repo-clone.git master
2. Create ImageStream tag

buildconfig/example-ray-job-image-stream.yaml

apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
  name: example-ray-job-image
spec:
  lookupPolicy:
    local: false
  tags:
  - name: latest
    from:
      kind: DockerImage
      name: res-cpe-team-docker-local.artifactory.swg-devops.com/cpe/tracker/example-ray-job
    referencePolicy:
      type: Source
3. Create BuildConfig

buildconfig/example-ray-job-build.yaml

apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
  name: ray-example
  labels:
    app: ray-example
spec:
  triggers: 
    - type: "GitHub"
      github:
        secret: "rayrepoclone"
  source:
    type: Git
    git:
      uri: https://github.com/sunya-ch/ray-repo-clone
    contextDir: docker/ray
  strategy:
    type: Docker                      
    dockerStrategy:
      dockerfilePath: Dockerfile
  output:
    to:
      kind: ImageStreamTag
      name: example-ray-job-image:latest
    pushSecret:
      name: res-cpe-team-docker-local