One example is to allow us to change the ovn-kubernetes code that
decides what e2e tests are run.  That's needed on older stable branches
that don't support all the features that newer OVN versions do.

Currently, on the main branch, there's no custom change required but on
older branches (branch-22.09 -> branch-22.03) the affinity timeout
related tests should be disabled because the OVN feature didn't exist
there.  An upcoming patch does that.

Signed-off-by: Dumitru Ceara <dce...@redhat.com>
---
 .ci/ovn-kubernetes/Dockerfile        |   10 +++++++++-
 .ci/ovn-kubernetes/custom.patch      |    0 
 .ci/ovn-kubernetes/prepare.sh        |   20 ++++++++++++++++++++
 .github/workflows/ovn-kubernetes.yml |    7 +++++++
 Makefile.am                          |    2 ++
 5 files changed, 38 insertions(+), 1 deletion(-)
 create mode 100644 .ci/ovn-kubernetes/custom.patch
 create mode 100755 .ci/ovn-kubernetes/prepare.sh

diff --git a/.ci/ovn-kubernetes/Dockerfile b/.ci/ovn-kubernetes/Dockerfile
index e74b620be8..7edf86a13a 100644
--- a/.ci/ovn-kubernetes/Dockerfile
+++ b/.ci/ovn-kubernetes/Dockerfile
@@ -47,9 +47,17 @@ RUN GO111MODULE=on go install 
github.com/ovn-org/libovsdb/cmd/modelgen@${LIBOVSD
 # Clone OVN Kubernetes and build the binary based on the commit passed as 
argument
 WORKDIR /root
 RUN git clone https://github.com/ovn-org/ovn-kubernetes.git
-WORKDIR /root/ovn-kubernetes/go-controller
+WORKDIR /root/ovn-kubernetes
 RUN git checkout ${OVNKUBE_COMMIT} && git log -n 1
 
+# Copy the ovn-kubernetes scripts from the OVN sources and apply any
+# custom changes if needed.
+RUN mkdir -p /tmp/ovn/.ci/ovn-kubernetes
+COPY .ci/ovn-kubernetes /tmp/ovn/.ci/ovn-kubernetes
+WORKDIR /tmp/ovn
+RUN .ci/ovn-kubernetes/prepare.sh /root/ovn-kubernetes
+
+WORKDIR /root/ovn-kubernetes/go-controller
 # Make sure we use the OVN NB/SB schema from the local code.
 COPY --from=ovnbuilder /tmp/ovn/ovn-nb.ovsschema pkg/nbdb/ovn-nb.ovsschema
 COPY --from=ovnbuilder /tmp/ovn/ovn-sb.ovsschema pkg/sbdb/ovn-sb.ovsschema
diff --git a/.ci/ovn-kubernetes/custom.patch b/.ci/ovn-kubernetes/custom.patch
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/.ci/ovn-kubernetes/prepare.sh b/.ci/ovn-kubernetes/prepare.sh
new file mode 100755
index 0000000000..8fc9652afd
--- /dev/null
+++ b/.ci/ovn-kubernetes/prepare.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+set -ev
+
+ovnk8s_path=$1
+topdir=$PWD
+
+pushd ${ovnk8s_path}
+
+# Add here any custom operations that need to performed on the
+# ovn-kubernetes cloned repo, e.g., custom patches.
+
+# git apply --allow-empty is too new so not all git versions from major
+# distros support it, just check if the custom patch file is not empty
+# before applying it.
+[ -s ${topdir}/.ci/ovn-kubernetes/custom.patch ] && \
+    git apply -v ${topdir}/.ci/ovn-kubernetes/custom.patch
+
+popd # ${ovnk8s_path}
+exit 0
diff --git a/.github/workflows/ovn-kubernetes.yml 
b/.github/workflows/ovn-kubernetes.yml
index 344937e53a..070d96bcb3 100644
--- a/.github/workflows/ovn-kubernetes.yml
+++ b/.github/workflows/ovn-kubernetes.yml
@@ -91,12 +91,19 @@ jobs:
         go-version: ${{ env.GO_VERSION }}
       id: go
 
+    - name: Check out ovn
+      uses: actions/checkout@v2
+
     - name: Check out ovn-kubernetes
       uses: actions/checkout@v3
       with:
           path: src/github.com/ovn-org/ovn-kubernetes
           repository: ovn-org/ovn-kubernetes
 
+    - name: Prepare
+      run: |
+        .ci/ovn-kubernetes/prepare.sh src/github.com/ovn-org/ovn-kubernetes
+
     - name: Set up environment
       run: |
         export GOPATH=$(go env GOPATH)
diff --git a/Makefile.am b/Makefile.am
index 3b0df83938..8c60d4a719 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -91,6 +91,8 @@ EXTRA_DIST = \
        .ci/osx-build.sh \
        .ci/osx-prepare.sh \
        .ci/ovn-kubernetes/Dockerfile \
+       .ci/ovn-kubernetes/prepare.sh \
+       .ci/ovn-kubernetes/custom.patch \
        .github/workflows/test.yml \
        .github/workflows/ovn-kubernetes.yml \
        boot.sh \

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to