Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2.7] fix: Replace unapproved GH Actions with approved ones #569

Merged
merged 3 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/apidiff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ jobs:
go-apidiff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: 1.20.x
- uses: joelanford/go-apidiff@main
- name: Generate API diff
run: make apidiff
12 changes: 2 additions & 10 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.20.x
- uses: actions/[email protected]
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-build-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-build-go-${{ hashFiles('**/go.sum') }}
- name: Build
run: make operator
18 changes: 5 additions & 13 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Export tag
Expand Down Expand Up @@ -55,21 +55,13 @@ jobs:
COMMITDATE=${{ steps.export_tag.outputs.commit_date }}
COMMIT=${{ github.sha }}
- name: Install Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.20.x
- uses: actions/[email protected]
- uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-test-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-test-go-${{ hashFiles('**/go.sum') }}
- uses: engineerd/[email protected]
with:
version: "v0.16.0"
skipClusterCreation: "true"
version: v0.23.0
install_only: true
- name: Create kind cluster
run: make setup-kind
- name: E2E tests
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.20.x
- name: Analysis
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1
with:
args: -v
4 changes: 2 additions & 2 deletions .github/workflows/nightly-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
BUILD_DATE: ${{ steps.setoutputs.outputs.builddate}}
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set current date as env variable
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
needs: nightly_image
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Helm
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.20.x
- uses: actions/[email protected]
Expand Down
47 changes: 28 additions & 19 deletions .github/workflows/update-rancher-charts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ on:
ref:
description: "Branch to use for GitHub action workflow"
required: true
default: "master"
default: "release-v2.7"
charts_ref:
description: "Submit PR against the following rancher/charts branch (e.g. dev-v2.7)"
required: true
default: "dev-v2.7"
prev_eks_operator:
description: "Previous EKS operator version (e.g. 1.1.0-rc2)"
description: "Previous EKS operator version (e.g. 1.2.0-rc.1)"
required: true
default: ""
new_eks_operator:
Expand All @@ -35,32 +35,41 @@ jobs:
create-rancher-charts-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{github.event.inputs.ref}}
path: eks-operator
persist-credentials: false
- name: Checkout rancher/charts
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: rancher/charts
ref: ${{github.event.inputs.charts_ref}}
path: charts
- name: Run release script
persist-credentials: false
- name: Run release script # release script is responsible for git add/commit
run: ./eks-operator/.github/scripts/update-rancher-charts.sh ${{github.event.inputs.prev_eks_operator}} ${{github.event.inputs.new_eks_operator}} ${{github.event.inputs.prev_chart}} ${{github.event.inputs.new_chart}} ${{github.event.inputs.should_replace}}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
- name: Set timestamp
run: echo "TIMESTAMP=$(date +'%s')" >> "$GITHUB_ENV"
- name: Push changes
env:
USERNAME: highlander-ci-bot
TOKEN: ${{ secrets.CI_BOT_TOKEN }}
run: |
git remote add bot-fork https://${USERNAME}:${TOKEN}@github.com/highlander-ci-bot/charts.git
git push bot-fork HEAD:${{github.event.inputs.new_eks_operator}}-${{env.TIMESTAMP}}
- name: Create PR
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
token: ${{secrets.CI_BOT_TOKEN}}
push-to-fork: highlander-ci-bot/charts
title: 'Update EKS operator to v${{github.event.inputs.new_eks_operator}}'
body: |
Update EKS operator to v${{github.event.inputs.new_eks_operator}}
Changelog: https://github.com/rancher/eks-operator/releases/tag/v${{github.event.inputs.new_eks_operator}}
cc @rancher/highlander
branch-suffix: timestamp
base: ${{github.event.inputs.charts_ref}}
path: ./charts/
github-token: ${{secrets.CI_BOT_TOKEN}}
script: |
github.pulls.create({
owner: 'rancher',
repo: 'charts',
head: 'highlander-ci-bot:${{github.event.inputs.new_eks_operator}}-${{env.TIMESTAMP}}',
base: ${{github.event.inputs.charts_ref}},
title: 'Update EKS operator to v${{github.event.inputs.new_eks_operator}}',
body: 'Update EKS operator to v${{github.event.inputs.new_eks_operator}\n\nChangelog: https://github.com/rancher/eks-operator/releases/tag/v${{github.event.inputs.new_eks_operator}}\n\ncc @rancher/highlander'
})
49 changes: 29 additions & 20 deletions .github/workflows/update-rancher-dep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ on:
ref:
description: "Branch to use for GitHub action workflow"
required: true
default: "master"
default: "release-v2.7"
rancher_ref:
description: "Submit PR against the following rancher/rancher branch (e.g. release/v2.7)"
required: true
default: "release/v2.7"
new_eks:
description: "New EKS operator version (e.g. 1.1.0-rc2), don't include the 'v'"
description: "New EKS operator version (e.g. 1.2.0-rc.1), don't include the 'v'"
required: true
default: ""

Expand All @@ -24,35 +24,44 @@ jobs:
create-rancher-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{github.event.inputs.ref}}
path: eks-operator
persist-credentials: false
- name: Checkout rancher/rancher
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: rancher/rancher
ref: ${{github.event.inputs.rancher_ref}}
path: rancher
- uses: actions/setup-go@v4
persist-credentials: false
- uses: actions/setup-go@v5
with:
go-version: ${{ env.SETUP_GO_VERSION }}
- name: Run release script
- name: Run release script # release script is responsible for git add/commit
run: ./eks-operator/.github/scripts/update-rancher-dep.sh ${{github.event.inputs.new_eks}}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
- name: Set timestamp
run: echo "TIMESTAMP=$(date +'%s')" >> "$GITHUB_ENV"
- name: Push changes
env:
USERNAME: highlander-ci-bot
TOKEN: ${{ secrets.CI_BOT_TOKEN }}
run: |
git remote add bot-fork https://${USERNAME}:${TOKEN}@github.com/highlander-ci-bot/rancher.git
git push bot-fork HEAD:${{github.event.inputs.new_eks}}-${{env.TIMESTAMP}}
- name: Create PR
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
token: ${{secrets.CI_BOT_TOKEN}}
push-to-fork: highlander-ci-bot/rancher
title: ' Update EKS operator to v${{github.event.inputs.new_eks}}'
body: |
Update EKS operator to v${{github.event.inputs.new_eks}}
Changelog: https://github.com/rancher/eks-operator/releases/tag/v${{github.event.inputs.new_eks}}
cc @rancher/highlander
branch-suffix: timestamp
base: ${{github.event.inputs.rancher_ref}}
path: ./rancher/
github-token: ${{secrets.CI_BOT_TOKEN}}
script: |
github.pulls.create({
owner: 'rancher',
repo: 'rancher',
head: 'highlander-ci-bot:${{github.event.inputs.new_eks}}-${{env.TIMESTAMP}}',
base: ${{github.event.inputs.rancher_ref}},
title: 'Update EKS operator to v${{github.event.inputs.new_eks}}',
body: 'Update EKS operator to v${{github.event.inputs.new_eks}}\n\nChangelog: https://github.com/rancher/eks-operator/releases/tag/v${{github.event.inputs.new_eks}}\n\ncc @rancher/highlander'
})
12 changes: 2 additions & 10 deletions .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,11 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.20.x
- uses: actions/[email protected]
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-test-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-test-go-${{ hashFiles('**/go.sum') }}
- name: Run make verify
run: |
make verify
2 changes: 2 additions & 0 deletions .trivyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Requires upgrading to Go 1.21 but we can't do this before Rancher v2.7 gets updated
CVE-2023-45288
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ GINKGO_VER := v2.17.1
GINKGO_BIN := ginkgo
GINKGO := $(BIN_DIR)/$(GINKGO_BIN)-$(GINKGO_VER)

GO_APIDIFF_VER := v0.8.2
GO_APIDIFF_BIN := go-apidiff
GO_APIDIFF := $(BIN_DIR)/$(GO_APIDIFF_BIN)-$(GO_APIDIFF_VER)

SETUP_ENVTEST_VER := v0.0.0-20211110210527-619e6b92dab9
SETUP_ENVTEST_BIN := setup-envtest
SETUP_ENVTEST := $(BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER)
Expand Down Expand Up @@ -172,3 +176,10 @@ docker-build-e2e:
.PHOHY: delete-local-kind-cluster
delete-local-kind-cluster: ## Delete the local kind cluster
kind delete cluster --name=$(CLUSTER_NAME)


APIDIFF_OLD_COMMIT ?= $(shell git rev-parse origin/release-v2.7)

.PHONY: apidiff
apidiff: $(GO_APIDIFF) ## Check for API differences
$(GO_APIDIFF) $(APIDIFF_OLD_COMMIT) --print-compatible
2 changes: 1 addition & 1 deletion test/e2e/Dockerfile.e2e
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.suse.com/bci/golang:1.19 AS build
FROM registry.suse.com/bci/golang:1.20 AS build
RUN zypper -n install -l openssl-devel
WORKDIR /src
COPY go.mod go.sum /src/
Expand Down
Loading