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

Update Dockerfile.CI #134

Open
wants to merge 10 commits into
base: master
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
47 changes: 41 additions & 6 deletions .tekton/create-ci-image-pipelinerun.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
apiVersion: tekton.dev/v1beta1
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: create-push-ci-image
Expand All @@ -8,6 +8,9 @@ metadata:
"Dockerfile.CI".pathChanged() && ( event == "push" || event == "pull_request" )
pipelinesascode.tekton.dev/max-keep-runs: "5"
spec:
taskRunSpecs:
- pipelineTaskName: skopeo-copy
serviceAccountName: skopeo-copy-quay-creds
params:
- name: repo_url
value: "{{ repo_url }}"
Expand Down Expand Up @@ -39,6 +42,7 @@ spec:
results:
- name: image-name
- name: image-name-timestamp
- name: repository
steps:
- name: generate-image-name
image: quay.io/openshift-pipeline/ci
Expand All @@ -47,21 +51,26 @@ spec:
BRANCH_NAME={{ target_branch }}
IMAGE_NAME=""
IMAGE_NAME_TIMESTAMP=""
REPOSITORY=""
TIMESTAMP=$(date +"%y%m%d%H%M")

if [ "$BRANCH_NAME" == "master" ]; then
if [ {{ event_type }} == "pull_request" ]; then
IMAGE_NAME="image-registry.openshift-image-registry.svc:5000/pipelines-ci/ci:latest"
IMAGE_NAME_TIMESTAMP="image-registry.openshift-image-registry.svc:5000/pipelines-ci/ci:5.0-$TIMESTAMP"
REPOSITORY="image-registry"
else
IMAGE_NAME="quay.io/openshift-pipeline/ci:latest"
IMAGE_NAME_TIMESTAMP="quay.io/openshift-pipeline/ci:5.0-$TIMESTAMP"
IMAGE_NAME="quay.io/openshift-pipeline/chainstest:latest"
IMAGE_NAME_TIMESTAMP="quay.io/openshift-pipeline/chainstest:5.0-$TIMESTAMP"
REPOSITORY="quay.io"
fi
elif [[ "$BRANCH_NAME" == release-* ]]; then
if [ {{ event_type }} == "pull_request" ]; then
IMAGE_NAME="image-registry.openshift-image-registry.svc:5000/pipelines-ci/ci:${BRANCH_NAME#release-}"
REPOSITORY="image-registry"
else
IMAGE_NAME="quay.io/openshift-pipeline/ci:${BRANCH_NAME#release-}"
REPOSITORY="quay.io"
fi
IMAGE_NAME_TIMESTAMP="$IMAGE_NAME-$TIMESTAMP"
else
Expand All @@ -71,9 +80,10 @@ spec:

echo -n "$IMAGE_NAME" | tee $(results.image-name.path)
echo -n "$IMAGE_NAME_TIMESTAMP" | tee $(results.image-name-timestamp.path)
echo -n "$REPOSITORY" | tee $(results.repository.path)
runAfter:
- fetch-repository
- name: buildah
- name: buildah-push
taskRef:
kind: ClusterTask
name: buildah
Expand All @@ -89,6 +99,30 @@ spec:
workspace: source
- name: dockerconfig
workspace: dockerconfig
when:
- input: "quay.io"
operator: in
values:
- "$(tasks.generate-image-name.results.repository)"
- name: buildah-pull-request
taskRef:
kind: ClusterTask
name: buildah
params:
- name: IMAGE
value: $(tasks.generate-image-name.results.image-name)
- name: DOCKERFILE
value: ./Dockerfile.CI
runAfter:
- generate-image-name
workspaces:
- name: source
workspace: source
when:
- input: "image-registry"
operator: in
values:
- "$(tasks.generate-image-name.results.repository)"
- name: skopeo-copy
taskRef:
kind: ClusterTask
Expand All @@ -102,7 +136,8 @@ spec:
- name: destImageURL
value: docker://$(tasks.generate-image-name.results.image-name-timestamp)
runAfter:
- buildah
- buildah-push
- buildah-pull-request
finally:
- name: send-slack-notification
taskRef:
Expand Down Expand Up @@ -135,4 +170,4 @@ spec:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storage: 1Gi
2 changes: 1 addition & 1 deletion Dockerfile.CI
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN pip install pyyaml reportportal-client
RUN wget https://github.com/mikefarah/yq/releases/download/v4.40.5/yq_linux_amd64 -O /usr/bin/yq &&\
chmod +x /usr/bin/yq

ENV OC_VERSION=4.14
ENV OC_VERSION=4.11
RUN wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/fast-${OC_VERSION}/openshift-client-linux.tar.gz \
-O /tmp/openshift-client.tar.gz &&\
tar xzf /tmp/openshift-client.tar.gz -C /usr/bin oc &&\
Expand Down
Loading