# CI Images Test on Operator
## Pick up the build namespace
* Go to your PR and open the raw build-log. totxt pick-up where the namespace for your PR has been created. You should look like for a log message like this :
```
2019/09/20 08:51:52 Creating namespace
```
now you know that `ci-op-z1jqr9id` is the repository, you shoudd have access to that namespace on https://api.ci.openshift.org/console/ as long as you are the owner of that PR (it creates a `Rolebinding` for this).
## Generate yaml file
* Checkout openshift/pipeline and switch to the branch `openshift/release-next` (I assume your downstream remote is called `openshift`)
* execute the following from **bash** shell :
```bash
source ./openshift/resolve-yamls.sh
resolve_resources config /tmp/tekton-pipeline.yaml "nothing" registry.svc.ci.openshift.org/${NS}/stable
```
${NS} is the variable where you have stored your namespace.
## Setup a pullSecret to your default SA
You need to have access to that registry, from https://api.ci.openshift.org/console get your login command for login with the CLI.
When logged in, execute this :
```
oc registry login --to=/tmp/ciconfig.json
```
you should have a dockerconfig with your token in `/tmp/ciconfig.json`
Create a secret out of it :
```
kubectl create secret generic regcred \
--from-file=.dockerconfigjson=/tmp/ciconfig.json \
--type=kubernetes.io/dockerconfigjson
```
Get your default SA :
```
oc get sa -o yaml > /tmp/sa.yaml
```
Edit the /tmp/sa.yaml and add to the imagePullSecrets section the `-name: regcred` and remove the extra data not needed, this would look like this for me :
```yaml
apiVersion: v1
imagePullSecrets:
- name: default-dockercfg-wqsss
- name: regcred
kind: ServiceAccount
metadata:
name: default
namespace: tekton-pipelines
secrets:
- name: default-dockercfg-wqsss
- name: default-token-d6dls
```
now execute :
```bash
oc create -f /tmp/sa.yaml
```
## Apply templte
You can now apply the template with :
```
oc create -f /tmp/tekton-pipeline.yaml
```
It may have a race between the project creation and the deployments, so you may have to apply it twice if it can't find the `tektoncd-pipeline` project
It should be up and have pulled your image from the CI :
```
% oc describe -n tektoncd-pipeline pod tekton-pipelines-controller-77b5fd554f-wmf5d|grep Image:
Image: registry.svc.ci.openshift.org/ci-op-cqghg72m/stable:tektoncd-pipeline-controller
```
## Caveats
* The images get trashed after a while so you will need to rerun a CI run grab the new namespace and redo that whole shbang :heart_decoration: