Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoral2 committed Apr 19, 2024
2 parents a504d95 + d973fad commit b8947eb
Show file tree
Hide file tree
Showing 198 changed files with 7,029 additions and 3,757 deletions.
54 changes: 21 additions & 33 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ steps:
- pull_request

- name: build
image: rancher/dapper:v0.5.0
image: rancher/dapper:v0.6.0
secrets: [ AWS_SECRET_ACCESS_KEY-k3s-ci-uploader, AWS_ACCESS_KEY_ID-k3s-ci-uploader, unprivileged_github_token ]
environment:
GITHUB_TOKEN:
Expand All @@ -48,7 +48,7 @@ steps:
path: /var/run/docker.sock

- name: validate-cross-compilation
image: rancher/dapper:v0.5.0
image: rancher/dapper:v0.6.0
commands:
- dapper validate-cross-compilation
volumes:
Expand All @@ -73,7 +73,7 @@ steps:
- tag

- name: github_binary_release
image: ibuildthecloud/github-release:v0.0.1
image: plugins/github-release
settings:
api_key:
from_secret: github_token
Expand Down Expand Up @@ -114,7 +114,7 @@ steps:
- tag

- name: test
image: rancher/dapper:v0.5.0
image: rancher/dapper:v0.6.0
secrets: [ AWS_SECRET_ACCESS_KEY-k3s-ci-uploader, AWS_ACCESS_KEY_ID-k3s-ci-uploader ]
environment:
ENABLE_REGISTRY: 'true'
Expand All @@ -131,23 +131,6 @@ steps:
- name: docker
path: /var/run/docker.sock

- name: github_e2e_logs_release
image: ibuildthecloud/github-release:v0.0.1
settings:
api_key:
from_secret: github_token
prerelease: true
files:
- "dist/artifacts/e2e-*.log"
when:
instance:
- drone-publish.k3s.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag

volumes:
- name: docker
host:
Expand All @@ -169,7 +152,7 @@ trigger:

steps:
- name: build
image: rancher/dapper:v0.5.0
image: rancher/dapper:v0.6.0
commands:
- dapper ci
- echo "${DRONE_TAG}-amd64" | sed -e 's/+/-/g' >.tags
Expand All @@ -178,7 +161,7 @@ steps:
path: /var/run/docker.sock

- name: test
image: rancher/dapper:v0.5.0
image: rancher/dapper:v0.6.0
environment:
ENABLE_REGISTRY: 'true'
commands:
Expand Down Expand Up @@ -228,7 +211,7 @@ steps:
- pull_request

- name: build
image: rancher/dapper:v0.5.0
image: rancher/dapper:v0.6.0
secrets: [ AWS_SECRET_ACCESS_KEY-k3s-ci-uploader, AWS_ACCESS_KEY_ID-k3s-ci-uploader ]
environment:
AWS_SECRET_ACCESS_KEY:
Expand All @@ -243,7 +226,7 @@ steps:
path: /var/run/docker.sock

- name: github_binary_release
image: ibuildthecloud/github-release:v0.0.1
image: plugins/github-release
settings:
api_key:
from_secret: github_token
Expand Down Expand Up @@ -284,7 +267,7 @@ steps:
- tag

- name: test
image: rancher/dapper:v0.5.0
image: rancher/dapper:v0.6.0
secrets: [ AWS_SECRET_ACCESS_KEY-k3s-ci-uploader, AWS_ACCESS_KEY_ID-k3s-ci-uploader ]
environment:
ENABLE_REGISTRY: 'true'
Expand Down Expand Up @@ -339,6 +322,11 @@ steps:
- pull_request

- name: build
# Keeping Dapper at v0.5.0 for armv7, as newer versions fails with
# Bad system call on this architecture. xref:
#
# https://github.com/k3s-io/k3s/pull/8959#discussion_r1439736566
# https://drone-pr.k3s.io/k3s-io/k3s/7922/3/3
image: rancher/dapper:v0.5.0
secrets: [ AWS_SECRET_ACCESS_KEY-k3s-ci-uploader, AWS_ACCESS_KEY_ID-k3s-ci-uploader ]
environment:
Expand All @@ -354,7 +342,7 @@ steps:
path: /var/run/docker.sock

- name: github_binary_release
image: ibuildthecloud/github-release:v0.0.1
image: plugins/github-release:linux-arm
settings:
api_key:
from_secret: github_token
Expand Down Expand Up @@ -395,6 +383,7 @@ steps:
- tag

- name: test
# Refer to comment for arm/build.
image: rancher/dapper:v0.5.0
secrets: [ AWS_SECRET_ACCESS_KEY-k3s-ci-uploader, AWS_ACCESS_KEY_ID-k3s-ci-uploader ]
environment:
Expand Down Expand Up @@ -448,7 +437,7 @@ steps:
- pull_request

- name: validate_go_mods
image: rancher/dapper:v0.5.0
image: rancher/dapper:v0.6.0
commands:
- docker build --target test-mods -t k3s:mod -f Dockerfile.test .
- docker run -i k3s:mod
Expand Down Expand Up @@ -604,7 +593,7 @@ steps:
- pull_request

- name: build-e2e-image
image: rancher/dapper:v0.5.0
image: rancher/dapper:v0.6.0
commands:
- DOCKER_BUILDKIT=1 docker build --target test-e2e -t test-e2e -f Dockerfile.test .
- SKIP_VALIDATE=true SKIP_AIRGAP=true GOCOVER=1 dapper ci
Expand Down Expand Up @@ -651,10 +640,10 @@ steps:
- vagrant destroy -f
- go test -v -timeout=45m ./validatecluster_test.go -ci -local
- cp ./coverage.out /tmp/artifacts/validate-coverage.out
- cd ../startup
- cd ../secretsencryption
- vagrant destroy -f
- go test -v -timeout=30m ./startup_test.go -ci -local
- cp ./coverage.out /tmp/artifacts/startup-coverage.out
- go test -v -timeout=30m ./secretsencryption_test.go -ci -local
- cp ./coverage.out /tmp/artifacts/se-coverage.out
- |
if [ "$DRONE_BUILD_EVENT" = "pull_request" ]; then
cd ../upgradecluster
Expand All @@ -680,7 +669,6 @@ steps:
files:
- /tmp/artifacts/validate-coverage.out
- /tmp/artifacts/se-coverage.out
- /tmp/artifacts/startup-coverage.out
- /tmp/artifacts/upgrade-coverage.out
flags:
- e2etests
Expand Down
29 changes: 29 additions & 0 deletions .github/actions/setup-go/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 'Setup golang with master only caching'
description: 'A composite action that installs golang, but with a caching strategy that only updates the cache on master branch.'
runs:
using: 'composite'
steps:
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod' # Just use whatever version is in the go.mod file
cache: ${{ github.ref == 'refs/heads/master' }}

- name: Prepare for go cache
if: ${{ github.ref != 'refs/heads/master' }}
shell: bash
run: |
echo "GO_CACHE=$(go env GOCACHE)" | tee -a "$GITHUB_ENV"
echo "GO_MODCACHE=$(go env GOMODCACHE)" | tee -a "$GITHUB_ENV"
echo "GO_VERSION=$(go env GOVERSION | tr -d 'go')" | tee -a "$GITHUB_ENV"
- name: Setup read-only cache
if: ${{ github.ref != 'refs/heads/master' }}
uses: actions/cache/restore@v4
with:
path: |
${{ env.GO_MODCACHE }}
${{ env.GO_CACHE }}
# Match the cache key to the setup-go action https://github.com/actions/setup-go/blob/main/src/cache-restore.ts#L34
key: setup-go-${{ runner.os }}-${{ env.ImageOS }}-go-${{ env.GO_VERSION }}-${{ hashFiles('go.sum') }}
restore-keys: |
setup-go-${{ runner.os }}-
33 changes: 33 additions & 0 deletions .github/actions/vagrant-setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 'Setup Vagrant and Libvirt'
description: 'A composite action that installs latest versions of vagrant and libvirt for use on ubuntu based runners'
runs:
using: 'composite'
steps:
- name: Add vagrant to apt-get sources
shell: bash
run: |
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo sed -i 's/^# deb-src/deb-src/' /etc/apt/sources.list
- name: Install vagrant and libvirt
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y libvirt-daemon libvirt-daemon-system vagrant
sudo systemctl enable --now libvirtd
- name: Build vagrant dependencies
shell: bash
run: |
sudo apt-get build-dep -y vagrant ruby-libvirt
sudo apt-get install -y --no-install-recommends libxslt-dev libxml2-dev libvirt-dev ruby-bundler ruby-dev zlib1g-dev
# This is a workaround for the libvirt group not being available in the current shell
# https://github.com/actions/runner-images/issues/7670#issuecomment-1900711711
- name: Make the libvirt socket rw accessible to everyone
shell: bash
run: |
sudo chmod a+rw /var/run/libvirt/libvirt-sock

- name: Install vagrant-libvirt plugin
shell: bash
run: vagrant plugin install vagrant-libvirt
55 changes: 0 additions & 55 deletions .github/stale.yml

This file was deleted.

20 changes: 15 additions & 5 deletions .github/workflows/build-k3s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,46 @@ on:
type: boolean
required: false
default: false
upload-image:
type: boolean
required: false
default: false

permissions:
contents: read

jobs:
build:
name: Build
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout K3s
uses: actions/checkout@v4
- name: Build K3s binary
run: |
DOCKER_BUILDKIT=1 SKIP_IMAGE=1 SKIP_AIRGAP=1 SKIP_VALIDATE=1 GOCOVER=1 make
sha256sum dist/artifacts/k3s | sed 's|dist/artifacts/||' > dist/artifacts/k3s.sha256sum
- name: Build K3s image
if: inputs.upload-image == true
run: make package-image
- name: bundle repo
if: inputs.upload-repo == true
run: |
tar -czvf ../k3s-repo.tar.gz .
mv ../k3s-repo.tar.gz .
- name: "Upload K3s directory"
if: inputs.upload-repo == true
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: k3s-repo.tar.gz
path: k3s-repo.tar.gz
- name: "Save K3s image"
if: inputs.upload-image == true
run: docker image save rancher/k3s -o ./dist/artifacts/k3s-image.tar
- name: "Upload K3s binary"
if: inputs.upload-repo == false
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: k3s
path: dist/artifacts/k3s
path: dist/artifacts/k3s*
Loading

0 comments on commit b8947eb

Please sign in to comment.