Skip to content

Commit

Permalink
[release-1.8] Align github actions from newer branches (#2287)
Browse files Browse the repository at this point in the history
* [release-1.8] Align github actions from newer branches

Backport a few configuration changes
in github actions.

Signed-off-by: stirabos <[email protected]>

* Fix bug and change cri selection procedure of cluster-sync. (#2155)

The command for getting the registry port gets more than one output,
which breaks following commands in the deploying scripts. The output is
now parsed to pickup just the first port.

Also the container runtime selection was hardcoded, now it uses the cri
selection script of kubervirtci.

Co-authored-by: Felix Matouschek <[email protected]>
Signed-off-by: Javier Cano Cano <[email protected]>

Signed-off-by: Javier Cano Cano <[email protected]>
Co-authored-by: Felix Matouschek <[email protected]>

* cluster-up: Fix tag updating (#2189)

In case the _kubevirtci folder exists,
changing the tag won't reclone the folder.
The cluster-up folder won't be updated and it can lead
to bugs in case the folder is changed.

Fix it by deleting the folder in case of tag mismatch.
It will enforce a reclone.

Signed-off-by: Or Shoval <[email protected]>

Signed-off-by: Or Shoval <[email protected]>

* Bump the default kubevirtci provider

Signed-off-by: stirabos <[email protected]>

* Workaround for SELinux boolean for chardev

Workaround for kubevirt/kubevirt#9434
we started setting SELinux boolean for chardev access
with kubevirt/kubevirtci#968
but it got reverted with kubevirt/kubevirtci#975
altough it's still needed with Kubevirt v0.58.1
TODO: let's remove this once kubevirt/kubevirt#9434
is fixed

Signed-off-by: stirabos <[email protected]>

---------

Signed-off-by: stirabos <[email protected]>
Signed-off-by: Javier Cano Cano <[email protected]>
Signed-off-by: Or Shoval <[email protected]>
Co-authored-by: Javier Cano Cano <[email protected]>
Co-authored-by: Felix Matouschek <[email protected]>
Co-authored-by: oscollabus <[email protected]>
  • Loading branch information
4 people authored Mar 20, 2023
1 parent efbcf86 commit ca9cc7e
Show file tree
Hide file tree
Showing 13 changed files with 79 additions and 40 deletions.
17 changes: 15 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!-- Thanks for sending a pull request! Here are some tips for you:
1. Follow the instructions for writing a release note from k8s: https://git.k8s.io/community/contributors/guide/release-notes.md
-->

**What this PR does / why we need it**:

**Reviewer Checklist**
<!-- Check [Expectations from a PR](/CONTRIBUTING.md#expectations-from-a-pr) for the details -->

Expand All @@ -14,7 +20,15 @@
- [ ] Uninstallation Scenario
- [ ] Backward Compatibility
- [ ] Troubleshooting Friendly


**Jira Ticket**:
<!-- Write the link to the Jira ticket:
If the task is not tracked by a Jira ticket, just write "NONE".
-->
```jira-ticket
```

**Release note**:
<!-- Write your release note:
1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string "action required".
Expand All @@ -23,4 +37,3 @@
```release-note
```

4 changes: 2 additions & 2 deletions .github/workflows/build-push-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ jobs:
OPM_VERSION: v1.26.2
steps:
- name: Checkout the latest code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: '1.19'
- name: Get latest version
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dashboard-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout this repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: main
path: hco

- name: Checkout monitoring repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: kubevirt/monitoring
ref: main
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/digester_bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
echo "NEW_PR=true" >> $GITHUB_ENV
fi
- uses: actions/checkout@v2
- uses: actions/checkout@v3
if: ${{ env.NEW_PR }}
with:
ref: main

- uses: actions/setup-go@v2
- uses: actions/setup-go@v3
if: ${{ env.NEW_PR }}
with:
go-version: '1.19' # The Go version to download (if necessary) and use.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/graphs-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout this repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: main
path: hco
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/override-bot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python3
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/pr-sanity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ jobs:

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/setup-go@v2
- uses: actions/setup-go@v3
with:
go-version: '1.19' # The Go version to download (if necessary) and use.
go-version: '1.19' # The Go version to download (if necessary) and use.

- name: Do sanity checks
run: make sanity

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v2.5.2
uses: golangci/golangci-lint-action@v3
with:
skip-go-installation: true
version: v1.51.2
skip-pkg-cache: true
args: --timeout=5m
args: --timeout=5m --out-${NO_FUTURE}format line-number

- name: Verify we can actually build the operator
run: make build
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-community-operators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- v1.*
jobs:
publish_hco:
if: (github.repository == 'kubevirt/hyperconverged-cluster-operator')
if: (github.repository == 'kubevirt/hyperconverged-cluster-operator' && !contains(github.ref, 'unstable'))
name: Publish HCO tagged version to community-operators
runs-on: ubuntu-latest
env:
Expand All @@ -30,11 +30,11 @@ jobs:
echo "TARGET_BRANCH=${TARGET_BRANCH}" >> $GITHUB_ENV
echo "TAGGED_VERSION=${TAGGED_VERSION}" >> $GITHUB_ENV
- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: '1.19'
- name: Checkout the latest code of ${{ env.TARGET_BRANCH }} branch
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ env.TARGET_BRANCH }}
fetch-depth: 2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rebase-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.HCO_BOT_TOKEN }}

- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: '1.19'

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release-bumper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
outputs:
matrix: ${{ steps.set_branches.outputs.matrix }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: main
fetch-depth: 0

- id: set_branches
run: |
matrix=$(git for-each-ref --format='%(refname:short)' refs/remotes/origin | grep -e "origin/main" -e "origin/release-1.[0-9]\+$" | grep -v "release-1\.[0,1,2,3]$" | sed -r 's/origin\/(.*)/{"branch": "\1"}/g' | jq -s)
echo "::set-output name=matrix::{\"branches\":$(echo $matrix)}"
echo "matrix={\"branches\":$(echo $matrix)}" >> $GITHUB_OUTPUT
bump_components_version:
name: Bump Components Versions
Expand All @@ -37,11 +37,11 @@ jobs:
matrix: ${{fromJson(needs.set_bump_branches.outputs.matrix)}}
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: ${{ matrix.branches.branch }}

- uses: actions/setup-go@v2
- uses: actions/setup-go@v3
with:
go-version: '1.19' # The Go version to download (if necessary) and use.

Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ WEBHOOK_IMAGE ?= $(REGISTRY_NAMESPACE)/hyperconverged-cluster-webhook
FUNC_TEST_IMAGE ?= $(REGISTRY_NAMESPACE)/hyperconverged-cluster-functest
VIRT_ARTIFACTS_SERVER ?= $(REGISTRY_NAMESPACE)/virt-artifacts-server
LDFLAGS ?= -w -s
GOLANDCI_LINT_VERSION ?= v1.51.2



Expand All @@ -36,10 +37,9 @@ goimport:


lint:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANDCI_LINT_VERSION}
golangci-lint run
go install github.com/nunnatsa/ginkgolinter/cmd/ginkgolinter@latest
ginkgolinter ./...
(cd tests && ginkgolinter ./...)
(cd tests && golangci-lint run)

build: build-operator build-csv-merger build-webhook

Expand Down Expand Up @@ -101,7 +101,7 @@ container-build-validate-bundles:
podman build -f tools/operator-sdk-validate/Dockerfile -t operator-sdk-validate-hco .

container-build-functest:
podman build -f build/Dockerfile.functest -t $(IMAGE_REGISTRY)/$(FUNC_TEST_IMAGE):$(IMAGE_TAG) --build-arg git_sha=$(SHA) .
. "hack/cri-bin.sh" && $$CRI_BIN build -f build/Dockerfile.functest -t $(IMAGE_REGISTRY)/$(FUNC_TEST_IMAGE):$(IMAGE_TAG) --build-arg git_sha=$(SHA) .

container-build-artifacts-server:
podman build -f build/Dockerfile.artifacts -t $(IMAGE_REGISTRY)/$(VIRT_ARTIFACTS_SERVER):$(IMAGE_TAG) --build-arg git_sha=$(SHA) .
Expand All @@ -118,7 +118,7 @@ container-push-webhook:
. "hack/cri-bin.sh" && $$CRI_BIN push $$CRI_INSECURE $(IMAGE_REGISTRY)/$(WEBHOOK_IMAGE):$(IMAGE_TAG)

container-push-functest:
podman push $(IMAGE_REGISTRY)/$(FUNC_TEST_IMAGE):$(IMAGE_TAG)
. "hack/cri-bin.sh" && $$CRI_BIN push $$CRI_INSECURE $(IMAGE_REGISTRY)/$(FUNC_TEST_IMAGE):$(IMAGE_TAG)

container-push-artifacts-server:
podman push $(IMAGE_REGISTRY)/$(VIRT_ARTIFACTS_SERVER):$(IMAGE_TAG)
Expand All @@ -130,7 +130,7 @@ cluster-down:
./cluster/down.sh

cluster-sync:
./cluster/sync.sh
IMAGE_REGISTRY=$(IMAGE_REGISTRY) REGISTRY_NAMESPACE=$(REGISTRY_NAMESPACE) ./cluster/sync.sh

cluster-clean:
CMD="./cluster/kubectl.sh" ./hack/clean.sh
Expand Down
32 changes: 30 additions & 2 deletions cluster/kubevirtci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,39 @@
# See the License for the specific language governing permissions and
# limitations under the License.

export KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER:-'k8s-1.23'}
export KUBEVIRTCI_TAG=$(curl -L -Ss https://storage.googleapis.com/kubevirt-prow/release/kubevirt/kubevirtci/latest)
export KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER:-'k8s-1.24'}
######
# workaround for https://github.com/kubevirt/kubevirt/issues/9434
# we started setting SELinux boolean for chardev access
# with https://github.com/kubevirt/kubevirtci/pull/968
# but it got reverted with https://github.com/kubevirt/kubevirtci/pull/975
# altough it's still needed with Kubevirt v0.58.1
# TODO: let's remove this once https://github.com/kubevirt/kubevirt/issues/9434
# is fixed
#
# export KUBEVIRTCI_TAG=$(curl -L -Ss https://storage.googleapis.com/kubevirt-prow/release/kubevirt/kubevirtci/latest)
export KUBEVIRTCI_TAG=2302221824-e1cf770
######

KUBEVIRTCI_PATH="${PWD}/_kubevirtci"
KUBEVIRTCI_REPO='https://github.com/kubevirt/kubevirtci.git'

function cluster::_get_repo() {
git --git-dir ${KUBEVIRTCI_PATH}/.git remote get-url origin
}

function cluster::_get_tag() {
git -C ${KUBEVIRTCI_PATH} describe --tags
}

function kubevirtci::install() {
# Remove cloned kubevirtci repository if it does not match the requested one
if [ -d ${KUBEVIRTCI_PATH} ]; then
if [ $(cluster::_get_repo) != ${KUBEVIRTCI_REPO} ] || [ $(cluster::_get_tag) != ${KUBEVIRTCI_TAG} ]; then
rm -rf ${KUBEVIRTCI_PATH}
fi
fi

if [ ! -d ${KUBEVIRTCI_PATH} ]; then
git clone https://github.com/kubevirt/kubevirtci.git ${KUBEVIRTCI_PATH}
(
Expand Down
12 changes: 5 additions & 7 deletions cluster/sync.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
#!/bin/bash -ex

source ./hack/common.sh
source ./_kubevirtci/cluster-up/cluster/ephemeral-provider-common.sh

container_command=podman

registry_port=$(${container_command} ps | grep -Po '(?<=0.0.0.0:)\d+(?=->5000\/tcp)' || echo "")

registry_port=$(${_cri_bin} ps | grep -Po '(?<=0.0.0.0:)\d+(?=->5000\/tcp)' | head -n 1)
if [ -z "$registry_port" ]
then
container_command=docker
registry_port=$(${container_command} ps | grep -Po '(?<=0.0.0.0:)\d+(?=->5000\/tcp)')
>&2 echo "unable to get the registry port"
exit 1
fi

registry=localhost:$registry_port
Expand Down Expand Up @@ -42,7 +40,7 @@ else
pull_command="docker"
fi

${container_command} ps -a
${_cri_bin} ps -a

for node in ${nodes[@]}; do
./cluster/ssh.sh ${node} "echo registry:5000/kubevirt/hyperconverged-cluster-operator | xargs \-\-max-args=1 sudo ${pull_command} pull"
Expand Down

0 comments on commit ca9cc7e

Please sign in to comment.