Skip to content

Commit

Permalink
.ci: ovn-kubernetes: Add a "prepare" stage to allow for custom actions.
Browse files Browse the repository at this point in the history
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>
Acked-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Mark Michelson <mmichels@redhat.com>
(cherry picked from commit 05a7b97)
  • Loading branch information
dceara committed Jan 13, 2023
1 parent f6f8c8d commit 5ab0839
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .ci/ovn-kubernetes/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Empty file added .ci/ovn-kubernetes/custom.patch
Empty file.
20 changes: 20 additions & 0 deletions .ci/ovn-kubernetes/prepare.sh
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions .github/workflows/ovn-kubernetes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,19 @@ jobs:
go-version: ${{ env.GO_VERSION }}
id: go

- name: Check out ovn
uses: actions/checkout@v3

- name: Check out ovn-kubernetes
uses: actions/checkout@v2
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)
Expand Down
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,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 \
Expand Down

0 comments on commit 5ab0839

Please sign in to comment.