diff mbox series

[ovs-dev,1/2] .ci: ovn-kubernetes: Add a "prepare" stage to allow for custom actions.

Message ID 167155025006.1303384.5921929500779571556.stgit@dceara.remote.csb
State Accepted
Headers show
Series Fix ovn-kubernetes CI jobs on stable branches. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes fail github build: failed

Commit Message

Dumitru Ceara Dec. 20, 2022, 3:30 p.m. UTC
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 <dceara@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

Comments

Dumitru Ceara Dec. 20, 2022, 3:44 p.m. UTC | #1
On 12/20/22 16:30, Dumitru Ceara wrote:
> 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 <dceara@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
> +

This should be actions/checkout@v3, I will fix it in v2 after v1 gets
some review time.

>      - 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
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
Ales Musil Jan. 12, 2023, 5:45 p.m. UTC | #2
On Tue, Dec 20, 2022 at 4:44 PM Dumitru Ceara <dceara@redhat.com> wrote:

> On 12/20/22 16:30, Dumitru Ceara wrote:
> > 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 <dceara@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
> <http://github.com/ovn-org/libovsdb/cmd/modelgen@$%7BLIBOVSD>
> >  # 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
> > +
>
> This should be actions/checkout@v3, I will fix it in v2 after v1 gets
> some review time.
>
> >      - 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
> > dev@openvswitch.org
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
> >
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
>
Looks good to me, thanks.

Acked-by: Ales Musil <amusil@redhat.com>
Mark Michelson Jan. 12, 2023, 7:58 p.m. UTC | #3
I made the change Dumitru suggested (checkout@v3 instead of checkout@v2) 
and merged both patches to main.

Thanks Dumitru and Ales!

On 1/12/23 12:45, Ales Musil wrote:
> On Tue, Dec 20, 2022 at 4:44 PM Dumitru Ceara <dceara@redhat.com> wrote:
> 
>> On 12/20/22 16:30, Dumitru Ceara wrote:
>>> 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 <dceara@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
>> <http://github.com/ovn-org/libovsdb/cmd/modelgen@$%7BLIBOVSD>
>>>   # 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
>>> +
>>
>> This should be actions/checkout@v3, I will fix it in v2 after v1 gets
>> some review time.
>>
>>>       - 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
>>> dev@openvswitch.org
>>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>>>
>>
>> _______________________________________________
>> dev mailing list
>> dev@openvswitch.org
>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>>
>>
> Looks good to me, thanks.
> 
> Acked-by: Ales Musil <amusil@redhat.com>
> 
>
Dumitru Ceara Jan. 12, 2023, 8:03 p.m. UTC | #4
On 1/12/23 20:58, Mark Michelson wrote:
> I made the change Dumitru suggested (checkout@v3 instead of checkout@v2)
> and merged both patches to main.
> 
> Thanks Dumitru and Ales!
> 

Thanks, Mark, but the second patch should not be pushed to branches
newer than 22.09.  We should revert it on main because we actually want
to run the ovnkube session affinity tests there and skip them on
branches <=22.09.

I can take care of the backports tomorrow, but it would be great if you
could already revert the patch on main branch.

Thanks,
Dumitru
Mark Michelson Jan. 12, 2023, 8:08 p.m. UTC | #5
On 1/12/23 15:03, Dumitru Ceara wrote:
> On 1/12/23 20:58, Mark Michelson wrote:
>> I made the change Dumitru suggested (checkout@v3 instead of checkout@v2)
>> and merged both patches to main.
>>
>> Thanks Dumitru and Ales!
>>
> 
> Thanks, Mark, but the second patch should not be pushed to branches
> newer than 22.09.  We should revert it on main because we actually want
> to run the ovnkube session affinity tests there and skip them on
> branches <=22.09.
> 
> I can take care of the backports tomorrow, but it would be great if you
> could already revert the patch on main branch.
> 

Sorry about that. I pushed a commit to revert patch 2 on main: 
https://github.com/ovn-org/ovn/commit/3abc62da8d323c52cfbf7f7dbad9cd50eb9afdcc

> Thanks,
> Dumitru
>
Dumitru Ceara Jan. 12, 2023, 8:09 p.m. UTC | #6
On 1/12/23 21:08, Mark Michelson wrote:
> On 1/12/23 15:03, Dumitru Ceara wrote:
>> On 1/12/23 20:58, Mark Michelson wrote:
>>> I made the change Dumitru suggested (checkout@v3 instead of checkout@v2)
>>> and merged both patches to main.
>>>
>>> Thanks Dumitru and Ales!
>>>
>>
>> Thanks, Mark, but the second patch should not be pushed to branches
>> newer than 22.09.  We should revert it on main because we actually want
>> to run the ovnkube session affinity tests there and skip them on
>> branches <=22.09.
>>
>> I can take care of the backports tomorrow, but it would be great if you
>> could already revert the patch on main branch.
>>
> 
> Sorry about that. I pushed a commit to revert patch 2 on main:
> https://github.com/ovn-org/ovn/commit/3abc62da8d323c52cfbf7f7dbad9cd50eb9afdcc
> 

Thanks for the quick response!
Dumitru Ceara Jan. 13, 2023, 1:47 p.m. UTC | #7
On 1/12/23 21:09, Dumitru Ceara wrote:
> On 1/12/23 21:08, Mark Michelson wrote:
>> On 1/12/23 15:03, Dumitru Ceara wrote:
>>> On 1/12/23 20:58, Mark Michelson wrote:
>>>> I made the change Dumitru suggested (checkout@v3 instead of checkout@v2)
>>>> and merged both patches to main.
>>>>
>>>> Thanks Dumitru and Ales!
>>>>
>>>
>>> Thanks, Mark, but the second patch should not be pushed to branches
>>> newer than 22.09.  We should revert it on main because we actually want
>>> to run the ovnkube session affinity tests there and skip them on
>>> branches <=22.09.
>>>
>>> I can take care of the backports tomorrow, but it would be great if you
>>> could already revert the patch on main branch.
>>>
>>
>> Sorry about that. I pushed a commit to revert patch 2 on main:
>> https://github.com/ovn-org/ovn/commit/3abc62da8d323c52cfbf7f7dbad9cd50eb9afdcc
>>
> 
> Thanks for the quick response!

I pushed the corresponding patches to all stable branches down to 22.03.

Unfortunately upstream ovn-kubernetes CI is flaky again so we still have
some control-plane test failures:

https://github.com/dceara/ovn/actions/runs/3910245152/jobs/6682549215#step:12:12531

Tim, Surya, do you maybe have some time to help us determine why these
fail so often?  I don't think anything major changed in OVN lately that
would cause these to fail.

The session affinity timeout conformance tests OTOH are skipped/run as
needed:

https://github.com/dceara/ovn/actions/runs/3910245152/jobs/6682548617
(skipped)

https://github.com/dceara/ovn/actions/runs/3910234735/jobs/6682600435
(executed)

Best regards,
Dumitru
diff mbox series

Patch

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 \