diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..d3ba3129c1 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,21 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: check-merge-conflict + - id: check-yaml + - id: trailing-whitespace + args: + - --markdown-linebreak-ext=md + - repo: local + hooks: + - id: cpo-containerfiles-in-sync + name: cpo-containerfiles-in-sync + entry: ./hack/tools/git-hooks/cpo-containerfiles-in-sync.sh + language: script + pass_filenames: false + args: + - Containerfile.control-plane + - Dockerfile.control-plane + description: Ensures the CPO container files stay in sync +exclude: '^vendor/|^hack/tools/vendor/|^api/vendor/' diff --git a/Containerfile.control-plane b/Containerfile.control-plane new file mode 100644 index 0000000000..b7c9b7a978 --- /dev/null +++ b/Containerfile.control-plane @@ -0,0 +1,27 @@ +FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_1.22 AS builder + +WORKDIR /hypershift + +COPY . . + +RUN make control-plane-operator control-plane-pki-operator + +FROM registry.redhat.io/rhel9-2-els/rhel:9.2 +COPY --from=builder /hypershift/bin/control-plane-operator /usr/bin/control-plane-operator +COPY --from=builder /hypershift/bin/control-plane-pki-operator /usr/bin/control-plane-pki-operator + +ENTRYPOINT /usr/bin/control-plane-operator + +LABEL io.openshift.release.operator=true +LABEL io.openshift.hypershift.control-plane-operator-subcommands=true +LABEL io.openshift.hypershift.control-plane-operator-skips-haproxy=true +LABEL io.openshift.hypershift.ignition-server-healthz-handler=true +LABEL io.openshift.hypershift.control-plane-operator-manages-ignition-server=true +LABEL io.openshift.hypershift.control-plane-operator-manages.cluster-machine-approver=true +LABEL io.openshift.hypershift.control-plane-operator-manages.cluster-autoscaler=true +LABEL io.openshift.hypershift.control-plane-operator-manages.decompress-decode-config=true +LABEL io.openshift.hypershift.control-plane-operator-creates-aws-sg=true +LABEL io.openshift.hypershift.control-plane-operator-applies-management-kas-network-policy-label=true +LABEL io.openshift.hypershift.restricted-psa=true +LABEL io.openshift.hypershift.control-plane-pki-operator-signs-csrs=true +LABEL io.openshift.hypershift.hosted-cluster-config-operator-reports-node-count=true diff --git a/hack/tools/git-hooks/cpo-containerfiles-in-sync.sh b/hack/tools/git-hooks/cpo-containerfiles-in-sync.sh new file mode 100755 index 0000000000..2f55d5b509 --- /dev/null +++ b/hack/tools/git-hooks/cpo-containerfiles-in-sync.sh @@ -0,0 +1,9 @@ +#!/bin/bash +echo >&2 "Processing " "$@" + +eval_cmd=("diff") +for f in "$@"; do + eval_cmd+=("<(sed -e '/^FROM /d' \"$f\")") +done + +eval "${eval_cmd[*]}"