-
Notifications
You must be signed in to change notification settings - Fork 19
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
File the pull request with information about the latest built and pushed image for the model #137
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a3c5908
The tekton.dev/pipeline label gets automatically added by Tekton,
adelton a4dff89
Record and retrieve image SHA from the latest test-mlflow-image Pipel…
adelton 805d169
Use the retrieved image SHA (to minimize race conditions).
adelton de4ed5b
Record and retrieve information about registry to which the image got…
adelton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
pipelines/tekton/gitops-update-pipeline/test-mlflow-retrieve-image-info-task.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Task | ||
metadata: | ||
name: retrieve-image-info | ||
spec: | ||
description: Retrieve location and SHA of the built image from the previous PipelineRun | ||
params: | ||
- name: namespace | ||
type: string | ||
- name: model-name | ||
type: string | ||
steps: | ||
- name: get-image-sha | ||
image: image-registry.openshift-image-registry.svc:5000/openshift/cli:latest | ||
script: | | ||
oc get -n $(params.namespace) pipelinerun --selector tekton.dev/pipeline=test-mlflow-image --sort-by=.status.completionTime -o jsonpath='{range .items[?(@.spec.params[0].name == "model-name")]}{.spec.params[?(@.name == "model-name")].value} {.status.results[?(@.name == "image-sha")].value} {.status.results[?(@.name == "target-registry-url")].value}{"\n"}{end}' | awk -v model=$(params.model-name) '$1 == model && NF == 3 { print $2, $3 }' | tail -1 | tee /dev/stderr | while read sha registry ; do echo -n "$sha" > $(results.image-sha.path) ; echo -n "$registry" > $(results.target-registry-url.path) ; done ; | ||
test -s $(results.image-sha.path) && test -s $(results.target-registry-url.path) | ||
results: | ||
- name: target-registry-url | ||
description: The target-registry-url where the image will be stored | ||
- name: image-sha | ||
description: The image checksum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
pipelines/tekton/test-mlflow-image-pipeline/test-mlflow-image-pipelinerun-bike-rental.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
...s/tekton/test-mlflow-image-pipeline/test-mlflow-image-pipelinerun-tensorflow-housing.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
pipelines/tekton/test-mlflow-image-pipeline/test-mlflow-record-image-task.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Task | ||
metadata: | ||
name: record-image | ||
spec: | ||
description: Record location and SHA of the built image | ||
params: | ||
- name: namespace | ||
type: string | ||
- name: model-name | ||
type: string | ||
- name: model-version | ||
type: string | ||
- name: target-registry-url | ||
type: string | ||
steps: | ||
- name: get-image-sha | ||
image: image-registry.openshift-image-registry.svc:5000/openshift/cli:latest | ||
script: | | ||
echo -n "$(params.target-registry-url)" | tee $(results.target-registry-url.path) ; | ||
echo ; | ||
oc get -n $(params.namespace) -o jsonpath='{.status.tags[?(@.tag == "$(params.model-version)")].items[0].image}' imagestream/$(params.model-name) | tee $(results.image-sha.path) | ||
results: | ||
- name: target-registry-url | ||
description: The target-registry-url where the image will be stored | ||
- name: image-sha | ||
description: The image checksum |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since a Task is supposed to be a reusable self-contained action, I think this script should stay embedded in the
Pipeline
since it is hardcoded totest-mlflow-image
.Instead of querying a
PipelineRun
, can we simplify this workflow to rely on a known incluster ImageTag OR a ConfigMap that holds the currentImagestreamTag
to reference for this Pipeline stepThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is, with a task defined merely as an entry in
tasks
inPipeline
, we are not able to haveresults
there, IIRC. The only place I foundresults
definition working is when I created it as a separateTask
.Yes, the task hardcodes
test-mlflow-image
-- but we have to hardcode something, to be able to reliably pick up the values from the previous PipelineRuns. I can turn it into a default of a parameter, if that's what you are suggesting.The problem of using an ImageTag -- we want to be able to record in the pull request the SHA-256 of the exact image that was tested by the
test-mlflow-image
Pipeline. And the tag can change between the testing PipelineRun running the application and this PipelineRun finding the tag. That's why the whole logic of providing that value throughresults
in the PipelineRuns.Or do you suggest for the
test-mlflow-image
to set some very-well-known tag like:testing-passed
any time the tests pass?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, my ideal approach would be to do it all in one Pipeline, test and file the pull request. But @piotrpdev was not fond of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your intent is sound but in the event we have to pass some config between PipelineRuns then we should use a configmap or annotation on the target object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I merged the changes after approval by @piotrpdev and after having #146 for the followup work. Let's consider this an interim quick-fix for the #125 problem and a baseline for further work.