Skip to content

Commit

Permalink
📂 Update openshift specific files.
Browse files Browse the repository at this point in the history
  • Loading branch information
alanfx committed Sep 18, 2019
1 parent 6747f35 commit 79c74aa
Show file tree
Hide file tree
Showing 27 changed files with 1,475 additions and 13 deletions.
70 changes: 70 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#This makefile is used by ci-operator

CGO_ENABLED=0
GOOS=linux
CORE_IMAGES=./cmd/bash ./cmd/controller ./cmd/entrypoint ./cmd/gsutil ./cmd/kubeconfigwriter ./cmd/nop ./cmd/webhook ./cmd/imagedigestexporter ./cmd/pullrequest-init
CORE_IMAGES_WITH_GIT=./cmd/creds-init ./cmd/git-init

##
# You need to provide a RELEASE_VERSION when using targets like `push-image`, you can do it directly
# on the command like this: `make push-image RELEASE_VERSION=0.4.0`
RELEASE_VERSION=
REGISTRY_CI_URL=registry.svc.ci.openshift.org/openshift/tektoncd-v$(RELEASE_VERSION):tektoncd-pipeline
REGISTRY_RELEASE_URL=quay.io/openshift-pipeline/tektoncd-pipeline

# Install core images
install: installuidwrapper
go install $(CORE_IMAGES) $(CORE_IMAGES_WITH_GIT)
.PHONY: install

# Run E2E tests on OpenShift
test-e2e: check-images
./openshift/e2e-tests-openshift.sh
.PHONY: test-e2e

# Make sure we have all images in the makefile variable or that would be a new
# binary that needs to be added
check-images:
@for cmd in ./cmd/*;do \
found="" ;\
for image in $(CORE_IMAGES) $(CORE_IMAGES_WITH_GIT);do \
if [[ $$image == $$cmd ]];then \
found=1 ;\
fi \
done ;\
test -n $$found || { \
echo "*ERROR*: Could not find $$cmd in the Makefile variables CORE_IMAGES_WITH_GIT CORE_IMAGES" ;\
echo "" ;\
echo "If it it's a new binary that was added upstream, then do the following :" ;\
echo "- Add the binary to openshift/release like this: https://git.io/fj18c" ;\
echo "- Add to the CORE_IMAGES variables in the Makefile" ;\
echo "- Generate the dockerfiles by running 'make generate-dockerfiles'" ;\
echo "- Commit and PR these to 'openshift/release-next' remote/branch and 'openshift/master'" ;\
exit 1 ;\
} && exit 0 ;\
done
.PHONY: check-images

# Generate Dockerfiles used by ci-operator. The files need to be committed manually.
generate-dockerfiles:
./openshift/ci-operator/generate-dockerfiles.sh openshift/ci-operator/Dockerfile.in openshift/ci-operator/knative-images $(CORE_IMAGES)
./openshift/ci-operator/generate-dockerfiles.sh openshift/ci-operator/Dockerfile-git.in openshift/ci-operator/knative-images $(CORE_IMAGES_WITH_GIT)
.PHONY: generate-dockerfiles

# NOTE(chmou): Install uidwraper for launching some binaries with fixed uid
UIDWRAPPER_PATH=./openshift/ci-operator/uidwrapper
installuidwrapper: $(UIDWRAPPER_PATH)
install -m755 $(UIDWRAPPER_PATH) $(GOPATH)/bin/

# Generates a ci-operator configuration for a specific branch.
generate-ci-config:
./openshift/ci-operator/generate-ci-config.sh $(BRANCH) > ci-operator-config.yaml
.PHONY: generate-ci-config

# Generate an aggregated knative yaml file with replaced image references
generate-release:
@test $(RELEASE_VERSION) || { echo "You need to set the RELEASE_VERSION on the command line i.e: make RELEASE_VERSION=0.4.0"; exit ;1;}
@./openshift/release/generate-release.sh v$(RELEASE_VERSION)
.PHONY: generate-release

.PHONY: push-image
16 changes: 3 additions & 13 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
# The OWNERS file is used by prow to automatically merge approved PRs.

approvers:
- bobcatfish
- dlorenc
- ImJasonH
- vdemeester
- abayer
- afrittoli
- dibyom
- sbwsg
- build-pipeline-approvers

# Alumni ❤️
# tejal29
# pivotal-nader-ziada
# shashwathi
# aaron-prindle
reviewers:
- build-pipeline-reviewers
24 changes: 24 additions & 0 deletions OWNERS_ALIASES
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
aliases:
build-pipeline-approvers:
- mgencur
- bbrowning
- jcrossley3
- markusthoemmes
- vdemeester
- arilivigni
- chmouel
- sthaha

build-pipeline-reviewers:
- mgencur
- bbrowning
- jcrossley3
- markusthoemmes
- vdemeester
- arilivigni
- chmouel
- sthaha
- nikhil-thomas
- hrishin
- piyush-garg
- pradeepitm12
19 changes: 19 additions & 0 deletions openshift/ci-operator/Dockerfile-git.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Do not edit! This file was generated via Makefile
FROM registry.access.redhat.com/ubi8/ubi:latest

# NOTE(chmou): We use dollar here so that envsubst don't get confused and expand
# our local PATH.
ENV HOME=/ko-app PATH=DOLLAR{HOME}:DOLLAR{PATH}
RUN yum install --disableplugin=subscription-manager -y git openssh-clients

COPY ${bin} DOLLAR{HOME}/${bin}.orig
COPY uidwrapper DOLLAR{HOME}/${bin}

RUN chgrp -R 0 DOLLAR{HOME} && \
chmod -R g=u DOLLAR{HOME} /etc/passwd

ENTRYPOINT ["/ko-app/${bin}"]

# Local Variables:
# mode: dockerfile
# End:
5 changes: 5 additions & 0 deletions openshift/ci-operator/Dockerfile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Do not edit! This file was generated via Makefile
FROM registry.access.redhat.com/ubi8/ubi:latest

ADD ${bin} /ko-app/${bin}
ENTRYPOINT ["/ko-app/${bin}"]
11 changes: 11 additions & 0 deletions openshift/ci-operator/build-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Dockerfile to bootstrap build and test in openshift-ci

FROM openshift/origin-release:golang-1.10

# Add kubernetes repository
ADD openshift/ci-operator/build-image/kubernetes.repo /etc/yum.repos.d/

RUN yum install -y kubectl ansible

# Allow runtime users to add entries to /etc/passwd
RUN chmod g+rw /etc/passwd
7 changes: 7 additions & 0 deletions openshift/ci-operator/build-image/kubernetes.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
15 changes: 15 additions & 0 deletions openshift/ci-operator/generate-dockerfiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -x

function generate_dockefiles() {
local dockerfile_in=$1;
local target_dir=$2; shift; shift
for img in $@; do
local image_base=$(basename $img)
mkdir -p $target_dir/$image_base
bin=$image_base envsubst < $dockerfile_in | sed 's/DOLLAR/$/g' > $target_dir/$image_base/Dockerfile
done
}

generate_dockefiles $@
5 changes: 5 additions & 0 deletions openshift/ci-operator/knative-images/bash/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Do not edit! This file was generated via Makefile
FROM registry.access.redhat.com/ubi8/ubi:latest

ADD bash /ko-app/bash
ENTRYPOINT ["/ko-app/bash"]
5 changes: 5 additions & 0 deletions openshift/ci-operator/knative-images/controller/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Do not edit! This file was generated via Makefile
FROM registry.access.redhat.com/ubi8/ubi:latest

ADD controller /ko-app/controller
ENTRYPOINT ["/ko-app/controller"]
19 changes: 19 additions & 0 deletions openshift/ci-operator/knative-images/creds-init/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Do not edit! This file was generated via Makefile
FROM registry.access.redhat.com/ubi8/ubi:latest

# NOTE(chmou): We use dollar here so that envsubst don't get confused and expand
# our local PATH.
ENV HOME=/ko-app PATH=${HOME}:${PATH}
RUN yum install --disableplugin=subscription-manager -y git openssh-clients

COPY creds-init ${HOME}/creds-init.orig
COPY uidwrapper ${HOME}/creds-init

RUN chgrp -R 0 ${HOME} && \
chmod -R g=u ${HOME} /etc/passwd

ENTRYPOINT ["/ko-app/creds-init"]

# Local Variables:
# mode: dockerfile
# End:
5 changes: 5 additions & 0 deletions openshift/ci-operator/knative-images/entrypoint/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Do not edit! This file was generated via Makefile
FROM registry.access.redhat.com/ubi8/ubi:latest

ADD entrypoint /ko-app/entrypoint
ENTRYPOINT ["/ko-app/entrypoint"]
19 changes: 19 additions & 0 deletions openshift/ci-operator/knative-images/git-init/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Do not edit! This file was generated via Makefile
FROM registry.access.redhat.com/ubi8/ubi:latest

# NOTE(chmou): We use dollar here so that envsubst don't get confused and expand
# our local PATH.
ENV HOME=/ko-app PATH=${HOME}:${PATH}
RUN yum install --disableplugin=subscription-manager -y git openssh-clients

COPY git-init ${HOME}/git-init.orig
COPY uidwrapper ${HOME}/git-init

RUN chgrp -R 0 ${HOME} && \
chmod -R g=u ${HOME} /etc/passwd

ENTRYPOINT ["/ko-app/git-init"]

# Local Variables:
# mode: dockerfile
# End:
5 changes: 5 additions & 0 deletions openshift/ci-operator/knative-images/gsutil/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Do not edit! This file was generated via Makefile
FROM registry.access.redhat.com/ubi8/ubi:latest

ADD gsutil /ko-app/gsutil
ENTRYPOINT ["/ko-app/gsutil"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Do not edit! This file was generated via Makefile
FROM registry.access.redhat.com/ubi8/ubi:latest

ADD imagedigestexporter /ko-app/imagedigestexporter
ENTRYPOINT ["/ko-app/imagedigestexporter"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Do not edit! This file was generated via Makefile
FROM registry.access.redhat.com/ubi8/ubi:latest

ADD kubeconfigwriter /ko-app/kubeconfigwriter
ENTRYPOINT ["/ko-app/kubeconfigwriter"]
5 changes: 5 additions & 0 deletions openshift/ci-operator/knative-images/nop/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Do not edit! This file was generated via Makefile
FROM registry.access.redhat.com/ubi8/ubi:latest

ADD nop /ko-app/nop
ENTRYPOINT ["/ko-app/nop"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Do not edit! This file was generated via Makefile
FROM registry.access.redhat.com/ubi8/ubi:latest

ADD pullrequest-init /ko-app/pullrequest-init
ENTRYPOINT ["/ko-app/pullrequest-init"]
5 changes: 5 additions & 0 deletions openshift/ci-operator/knative-images/webhook/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Do not edit! This file was generated via Makefile
FROM registry.access.redhat.com/ubi8/ubi:latest

ADD webhook /ko-app/webhook
ENTRYPOINT ["/ko-app/webhook"]
8 changes: 8 additions & 0 deletions openshift/ci-operator/uidwrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
if ! whoami &> /dev/null; then
if [ -w /etc/passwd ]; then
echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:${HOME}:/sbin/nologin" >> /etc/passwd
fi
fi

exec ${0}.orig $@
Loading

0 comments on commit 79c74aa

Please sign in to comment.