Skip to content

Commit

Permalink
Merge branch 'rancher:main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
wotsyula authored Oct 30, 2024
2 parents 3ad5b84 + 2e43ce4 commit a6d9158
Show file tree
Hide file tree
Showing 2,951 changed files with 216,480 additions and 184,057 deletions.
1,545 changes: 0 additions & 1,545 deletions .drone.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
name: Bug report
about: Create a report to help us improve
title: '[BUG]'
labels: 'kind/bug'
title: "[BUG]"
labels: kind/bug
assignees: ''

---
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
name: Feature request
about: Suggest an idea for this project
title: '[RFE] '
labels: 'kind/enhancement'
title: "[RFE] "
labels: kind/enhancement
assignees: ''

---
Expand Down
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/flaky-tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Flaky Tests
about: File a report of a flaky test from drone or automation runs
title: "[flaky-test]"
labels: kind/flaky-test
assignees: ''

---

**Flaky Test**

```
<!--File what test failed in automation.
Make sure to assign the appropriate engineering team.-->
```

**Release Branch**

source branch of PR: `release/vXXX`
<!-- List which source branch in rancher/rancher that the PR was -->

**Drone Build (if applicable)**

pipeline stage URL:
<!-- Link to the specific pipeline stage/step that the drone build failed if applicable-->
16 changes: 16 additions & 0 deletions .github/actions/install-yq/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Install yq"
description: "Install yq from source"
inputs:
version:
description: "yq version"
default: v4.44.3
arch:
description: "host arch"
required: true
runs:
using: "composite"
steps:
- name: install yq
shell: bash
run: curl -fsL https://github.com/mikefarah/yq/releases/download/${{ inputs.version }}/yq_linux_${{ inputs.arch }}.tar.gz | tar xz && mv yq_linux_${{ inputs.arch }} /usr/bin/yq

18 changes: 18 additions & 0 deletions .github/actions/k3s-images/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: "Download K3S images"
description: "Download k3s images txt file and save airgap images"
inputs:
k3s_version:
description: "k3s version"
required: true
runs:
using: "composite"
steps:
- name: Download images txt file
shell: bash
run: curl -sLf https://github.com/rancher/k3s/releases/download/${{ inputs.k3s_version }}/k3s-images.txt -o /tmp/k3s-images.txt
- name: Create k3s images file
shell: bash
run: |
images=$(grep -e 'docker.io/rancher/mirrored-pause' -e 'docker.io/rancher/mirrored-coredns-coredns' /tmp/k3s-images.txt)
xargs -n1 docker pull <<< "${images}"
docker save -o ./k3s-airgap-images.tar ${images}
106 changes: 106 additions & 0 deletions .github/actions/setup-build-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: "Setup Dependencies Variables"
description: "Setup Dependencies Variables from other files"
outputs:
CATTLE_KDM_BRANCH:
description: "CATTLE_KDM_BRANCH from package/Dockerfile"
value: ${{ steps.vars.outputs.CATTLE_KDM_BRANCH }}
CATTLE_K3S_VERSION:
description: "CATTLE_K3S_VERSION from package/Dockerfile"
value: ${{ steps.vars.outputs.CATTLE_K3S_VERSION }}
CATTLE_HELM_VERSION:
description: "CATTLE_HELM_VERSION from package/Dockerfile"
value: ${{ steps.vars.outputs.CATTLE_HELM_VERSION }}
HELM_VERSION:
description: "HELM_VERSION from package/Dockerfile"
value: ${{ steps.vars.outputs.HELM_VERSION }}
GO_VERSION:
description: "GO_VERSION from package/Dockerfile"
value: ${{ steps.vars.outputs.GO_VERSION }}
HELM_UNITTEST_VERSION:
description: "HELM_UNITTEST_VERSION from Dockerfile.dapper"
value: ${{ steps.vars.outputs.HELM_UNITTEST_VERSION }}
RKE_VERSION:
description: "RKE_VERSION from go.mod"
value: ${{ steps.vars.outputs.RKE_VERSION }}
CATTLE_RANCHER_WEBHOOK_VERSION:
description: "CATTLE_RANCHER_WEBHOOK_VERSION from scripts/export-config"
value: ${{ steps.vars.outputs.CATTLE_RANCHER_WEBHOOK_VERSION }}
CATTLE_CSP_ADAPTER_MIN_VERSION:
description: "CATTLE_CSP_ADAPTER_MIN_VERSION from scripts/export-config"
value: ${{ steps.vars.outputs.CATTLE_CSP_ADAPTER_MIN_VERSION }}
CATTLE_FLEET_VERSION:
description: "CATTLE_FLEET_VERSION from scripts/export-config"
value: ${{ steps.vars.outputs.CATTLE_FLEET_VERSION }}
runs:
using: "composite"
steps:
- id: vars
shell: bash
run: |
source scripts/export-config
CATTLE_KDM_BRANCH=$(grep -m1 'ARG CATTLE_KDM_BRANCH=' package/Dockerfile | cut -d '=' -f2)
CATTLE_K3S_VERSION=$(grep -m1 'ENV CATTLE_K3S_VERSION' package/Dockerfile | awk '{print $3}')
HELM_VERSION=$(grep -m1 'ENV HELM_VERSION' package/Dockerfile | awk '{print $3}')
CATTLE_HELM_VERSION=$(grep -m1 'ENV CATTLE_HELM_VERSION' package/Dockerfile | awk '{print $3}')
GO_VERSION=$(grep -m1 'golang:' package/Dockerfile | cut -d ':' -f2 | cut -d ' ' -f1)
HELM_UNITTEST_VERSION=$(grep -m1 'ENV HELM_UNITTEST_VERSION' Dockerfile.dapper | awk '{print $3}')
RKE_VERSION=$(grep -m1 'github.com/rancher/rke' go.mod | awk '{print $2}')
if [[ -z "$RKE_VERSION" ]]; then
RKE_VERSION=$(grep -m1 'github.com/rancher/rke' go.mod | awk '{print $4}')
fi
RKE_VERSION=$RKE_VERSION
CATTLE_RANCHER_WEBHOOK_VERSION=$CATTLE_RANCHER_WEBHOOK_VERSION
CATTLE_CSP_ADAPTER_MIN_VERSION=$CATTLE_CSP_ADAPTER_MIN_VERSION
CATTLE_FLEET_VERSION=$CATTLE_FLEET_VERSION
if [[ -z "$CATTLE_KDM_BRANCH" ]]; then
echo "CATTLE_KDM_BRANCH not found"
exit 1
fi
if [[ -z "$CATTLE_K3S_VERSION" ]]; then
echo "CATTLE_K3S_VERSION not found"
exit 1
fi
if [[ -z "$HELM_VERSION" ]]; then
echo "HELM_VERSION not found"
exit 1
fi
if [[ -z "$CATTLE_HELM_VERSION" ]]; then
echo "CATTLE_HELM_VERSION not found"
exit 1
fi
if [[ -z "$GO_VERSION" ]]; then
echo "GO_VERSION not found"
exit 1
fi
if [[ -z "$HELM_UNITTEST_VERSION" ]]; then
echo "HELM_UNITTEST_VERSION not found"
exit 1
fi
if [[ -z "$RKE_VERSION" ]]; then
echo "RKE_VERSION not found"
exit 1
fi
if [[ -z "$CATTLE_RANCHER_WEBHOOK_VERSION" ]]; then
echo "CATTLE_RANCHER_WEBHOOK_VERSION not found"
exit 1
fi
if [[ -z "$CATTLE_CSP_ADAPTER_MIN_VERSION" ]]; then
echo "CATTLE_CSP_ADAPTER_MIN_VERSION not found"
exit 1
fi
if [[ -z "$CATTLE_FLEET_VERSION" ]]; then
echo "CATTLE_FLEET_VERSION not found"
exit 1
fi
echo "CATTLE_KDM_BRANCH=$CATTLE_KDM_BRANCH" >> $GITHUB_OUTPUT
echo "CATTLE_K3S_VERSION=$CATTLE_K3S_VERSION" >> $GITHUB_OUTPUT
echo "HELM_VERSION=$HELM_VERSION" >> $GITHUB_OUTPUT
echo "CATTLE_HELM_VERSION=$CATTLE_HELM_VERSION" >> $GITHUB_OUTPUT
echo "GO_VERSION=$GO_VERSION" >> $GITHUB_OUTPUT
echo "HELM_UNITTEST_VERSION=$HELM_UNITTEST_VERSION" >> $GITHUB_OUTPUT
echo "RKE_VERSION=$RKE_VERSION" >> $GITHUB_OUTPUT
echo "CATTLE_RANCHER_WEBHOOK_VERSION=$CATTLE_RANCHER_WEBHOOK_VERSION" >> $GITHUB_OUTPUT
echo "CATTLE_CSP_ADAPTER_MIN_VERSION=$CATTLE_CSP_ADAPTER_MIN_VERSION" >> $GITHUB_OUTPUT
echo "CATTLE_FLEET_VERSION=$CATTLE_FLEET_VERSION" >> $GITHUB_OUTPUT
23 changes: 23 additions & 0 deletions .github/actions/setup-tag-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Setup TAG and HEAD_TAG env variables"
description: "Setup TAG and HEAD_TAG env variables"
runs:
using: "composite"
steps:
- shell: bash
run: |
ref_name="${{ github.ref_name }}"
TAG="${{ github.sha }}"
prefix="release/"
if [[ "$ref_name" == "main" ]]; then
TAG=v2.10-${{ github.sha }}-head
echo "HEAD_TAG=head" >> "$GITHUB_ENV"
elif [[ "$ref_name" == release/v* ]]; then
TAG=${ref_name#$prefix}-${{ github.sha }}-head
HEAD_TAG=${ref_name#$prefix}-head
echo "HEAD_TAG=$HEAD_TAG" >> "$GITHUB_ENV"
fi
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
TAG="$ref_name"
fi
echo "TAG=$TAG" >> "$GITHUB_ENV"
echo "GIT_TAG=$TAG" >> "$GITHUB_ENV"
29 changes: 27 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,35 @@
<!-- Describe what manual testing you did (if no testing was done, explain why). -->

### Automated Testing
<!--If you added/updated unit/integration/validation tests, describe what cases they cover and do not cover. -->
<!-- Ensure there are unit/integration/validation tests added (if possible); describe what cases they cover and do not cover. -->
* Test types added/modified:
* Unit
* Integration (Go Framework)
* Integration (v2prov Framework)
* Validation (Go Framework)
* Other - Explain: _EXPLAIN_
* None
* _REMOVE NOT APPLICABLE BULLET POINTS ABOVE_
* If "None" - Reason: _EXPLAIN THE REASON_
<!--
Non-exhaustive list of reasons:
- Lack of the framework capable of testing this fix/change
- Tight deadlines / critical priority to get fix/change in - !ensure GH issue is logged to add tests!
- No application logic is modified by this change, e.g. refactoring/cosmetic/non-code/test change
- Tests implemented in another PR elsewhere - !ensure GH PR link is added!
- Other (explain)
Note: Outside of the exceptions above, the "existing tests cover the changes" is very unlikely to be an acceptable reason as the existing tests generally don't cover the logic changes implemented by this PR
-->
* If "None" - GH Issue/PR: _LINK TO GH ISSUE/PR TO ADD TESTS_

Summary: _TODO_

## QA Testing Considerations
<!-- Highlight areas or (additional) cases that QA should test w.r.t a fresh install as well as the upgrade scenarios -->

### Regressions Considerations
<!-- Dedicated section to specifically call out any areas that with higher chance of regressions caused by this change, include estimation of probability of regressions -->
<!-- Dedicated section to specifically call out any areas that with higher chance of regressions caused by this change, include estimation of probability of regressions -->
_TODO_

Existing / newly added automated tests that provide evidence there are no regressions:
* _TODO_
11 changes: 11 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": [
"github>rancher/renovate-config#release"
],
"baseBranches": [
"release/v2.9"
],
"prHourlyLimit": 2,
"prConcurrentLimit": 4,
"prCreation": "status-success"
}
1 change: 1 addition & 0 deletions .github/runs-on.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_extends: .github-private
12 changes: 12 additions & 0 deletions .github/scripts/check-for-auto-generated-changes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
set -ue

go generate ./...

if [ -n "$(git status --porcelain)" ]; then
echo "Generated files have either been changed manually or were not updated."
echo
echo "The following generated files did differ after regeneration:"
git status --porcelain
exit 1
fi
39 changes: 39 additions & 0 deletions .github/scripts/check-for-go-mod-changes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/sh
set -ue

for DIRECTORY in . ./pkg/apis ./pkg/client; do
cd "$DIRECTORY"
go mod tidy
go mod verify
cd "$OLDPWD"
done

if [ -n "$(git status --porcelain)" ]; then
echo "go.mod is not up to date. Please 'run go mod tidy' and commit the changes."
echo
echo "The following go files did differ after tidying them:"
git status --porcelain
exit 1
fi

# Check diff between ./go.mod and ./pkg/apis/go.mod
badmodule="false"
while read -r module tag; do
# Get tag from module in ./go.mod
roottag=$(sed '1,/^require/d' go.mod | grep "${module} " | awk '{ print $2 }')
echo "${module}:"
echo "${tag} (./pkg/apis/go.mod)"
echo "${roottag} (./go.mod)"
# Compare with tag from module in ./pkg/apis/go.mod
if [ "${tag}" != "${roottag}" ]; then
echo "${module} is different ('${tag}' vs '${roottag}')"
badmodule="true"
fi
done << EOF
$(sed '1,/require/d' pkg/apis/go.mod | head -n -1 | grep -v indirect | grep rancher | awk '{ print $1,$2 }')
EOF

if [ "${badmodule}" = "true" ]; then
echo "Diff found between ./go.mod and ./pkg/apis/go.mod"
exit 1
fi
32 changes: 32 additions & 0 deletions .github/workflows/controller-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Controller Integration Tests

on:
workflow_dispatch:
pull_request:
push:
branches:
- 'release/*'

env:
GOARCH: amd64
CGO_ENABLED: 0
SETUP_GO_VERSION: '1.22.*'

jobs:
run-tests:
runs-on: ubuntu-latest

steps:
-
uses: actions/checkout@v3
with:
fetch-depth: 0
-
uses: actions/setup-go@v4
with:
go-version: ${{ env.SETUP_GO_VERSION }}
-
name: Run Integration Tests
env:
ENVTEST_K8S_VERSION: "1.30"
run: ./tests/controllers/run_controller_tests.sh
Loading

0 comments on commit a6d9158

Please sign in to comment.