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

build(linux): add Linux packaging and e2e tests #1071

Merged
merged 56 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
1819ee1
feat(wip): allow finch to build on Linux without Lima
pendo324 Jun 26, 2024
4ad889d
fix Makefile
pendo324 Jul 9, 2024
3bdf5c8
refactor lima_cmd_creator => nerdctl_cmd_creator
pendo324 Jul 9, 2024
01b5b73
fix some refactoring/renaming misses
pendo324 Jul 10, 2024
26c56dc
fix unit tests
pendo324 Jul 23, 2024
bf18a4d
Merge branch 'main' into linux
pendo324 Jul 23, 2024
7c52c4d
fix linting
pendo324 Jul 23, 2024
efc06d5
remove unnecessary mockgen call
pendo324 Jul 23, 2024
44b2fd5
remove unused code
pendo324 Jul 23, 2024
e4c14ed
fix windows unit tests
pendo324 Jul 23, 2024
e65052c
fix linux linting errors
pendo324 Jul 23, 2024
b6a070b
refactor to use standard Linux config path
pendo324 Jul 25, 2024
6e4ab1b
update docs
pendo324 Jul 25, 2024
0712bcd
fix shared settings not being inlined
pendo324 Jul 25, 2024
eec59bf
refactor support bundles to only export files that would be relevant …
pendo324 Jul 25, 2024
8b454e7
update build guards
pendo324 Jul 25, 2024
6fbb0ec
fix FinchRootDir
pendo324 Jul 25, 2024
5f0d7cf
refactor cmd/nerdctl for Linux
pendo324 Jul 25, 2024
03e23ef
refactor nerdctl to use custom paths for buildkit socket and nerdctl.…
pendo324 Jul 26, 2024
350d07f
fix linting
pendo324 Jul 26, 2024
d2e45f9
automatically set the NATIVE_BUILD parameter if using Linux since tha…
pendo324 Jul 29, 2024
11fadda
allow GITCOMMIT to be overwritten to make RPM builds easier
pendo324 Jul 29, 2024
cba2d82
finch-general => finch-all
pendo324 Jul 29, 2024
4dc7985
main_local.go => main_native.go
pendo324 Jul 29, 2024
dc6688b
remove ensureCredentials check in native mode
pendo324 Jul 29, 2024
72f0ce9
virtual_machine_local.go => virtual_machine_native.go
pendo324 Jul 29, 2024
2a3c9f5
ensure all remote only tests have _remote suffix
pendo324 Jul 29, 2024
564aa7d
prepend path to vended buildkit binaries for Fedora-based systems
pendo324 Jul 29, 2024
d84a7f5
fix Makefile not handling default case for NATIVE_BUILD not on Linux
pendo324 Jul 29, 2024
5b15065
simplify makefile
pendo324 Jul 30, 2024
e8743ab
rename variable
pendo324 Jul 30, 2024
ad62d42
add native build tag
pendo324 Jul 30, 2024
a1d03ee
update NerdctlCmdCreator comment
pendo324 Jul 30, 2024
b84b424
fix Makefile for non-native builds
pendo324 Jul 30, 2024
e3555cd
remove native build tag and simplify platform separation
pendo324 Aug 5, 2024
c83c38b
remove unnecessary remote in names
pendo324 Aug 5, 2024
3e3f4c3
fix unit tests
pendo324 Aug 6, 2024
601e040
fix BuildkitSocketPath
pendo324 Aug 21, 2024
1722e6d
build(linux): add RPM packaging files and e2e tests
pendo324 Aug 20, 2024
b6fe134
Merge branch 'main' into linux
pendo324 Sep 11, 2024
e0138e7
Merge branch 'linux' into linux-packaging-testing
pendo324 Sep 12, 2024
b90ebb2
fix typo in help replacement logic
pendo324 Sep 17, 2024
52ffc3b
minor updates to spec file
pendo324 Sep 17, 2024
c1c3edc
revert temporary changes to workflows
pendo324 Sep 17, 2024
70b7f9d
Merge branch 'main' into linux-packaging-testing
pendo324 Sep 17, 2024
1852e62
fix merge mistakes
pendo324 Sep 17, 2024
2d7532b
reorder test matrices for better readability
pendo324 Sep 17, 2024
923a68f
fix unit test
pendo324 Sep 17, 2024
a3f75f8
fix nerdctl_native test
pendo324 Sep 17, 2024
d648225
enable ARM runners
pendo324 Sep 17, 2024
dd962aa
address comments
pendo324 Sep 18, 2024
05465b5
fix directory permissions (allows non-root to list dir)
pendo324 Sep 18, 2024
e5e9700
fix path to finch dir
pendo324 Sep 18, 2024
344a581
fix nerdctl.toml path
pendo324 Sep 18, 2024
0f3ed06
fix windows runner arch to match real infra
pendo324 Sep 18, 2024
684f95a
remove faulty version tag from windows matrix
pendo324 Sep 18, 2024
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
1 change: 1 addition & 0 deletions .github/workflows/ci-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ on:
paths:
- '**.md'
- 'contrib/**'
- '!contrib/packaging/**'
- '.github/CODEOWNERS'

jobs:
Expand Down
192 changes: 49 additions & 143 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ on:
branches:
- main
paths-ignore:
- '**.md'
- 'contrib/**'
- '.github/CODEOWNERS'
- "**.md"
- "contrib/**"
- ".github/CODEOWNERS"
pull_request:
branches:
- main
paths-ignore:
- '**.md'
- 'contrib/**'
- '.github/CODEOWNERS'
paths:
- "**.go"
- "contrib/packaging/**"
- "!contrib/hello-finch/**"
- "!.github/CODEOWNERS"
workflow_dispatch:
permissions:
id-token: write
contents: write
Expand Down Expand Up @@ -141,154 +143,58 @@ jobs:
go-version-file: go.mod
cache: true
- run: make check-licenses
e2e-tests:
macos-e2e-tests:
strategy:
fail-fast: false
matrix:
os:
[
[self-hosted, macos, amd64, 13, test],
[self-hosted, macos, amd64, 14, test],
[self-hosted, macos, arm64, 13, test],
[self-hosted, macos, arm64, 14, test],
]
test-command: ['test-e2e-vm-serial', 'test-e2e-container']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
# We need to get all the git tags to make version injection work. See VERSION in Makefile for more detail.
fetch-depth: 0
persist-credentials: false
submodules: recursive
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: go.mod
cache: true
- name: Set output variables
id: vars
run: |
has_creds=${{ (github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name) && github.actor != 'dependabot[bot]' }}
echo "has_creds=$has_creds" >> $GITHUB_OUTPUT
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
if: ${{ steps.vars.outputs.has_creds == true }}
with:
role-to-assume: ${{ secrets.ROLE }}
role-session-name: credhelper-test
aws-region: ${{ secrets.REGION }}
- name: Clean up previous files
run: |
sudo rm -rf /opt/finch
sudo rm -rf ~/.finch
sudo rm -rf ./_output
if pgrep '^qemu-system'; then
sudo pkill '^qemu-system'
fi
if pgrep '^socket_vmnet'; then
sudo pkill '^socket_vmnet'
fi
- name: Install Rosetta 2
run: echo "A" | softwareupdate --install-rosetta || true
- run: brew install lz4 automake autoconf libtool yq
shell: zsh {0}
- name: Build project
run: |
export PATH="/opt/homebrew/opt/libtool/libexec/gnubin:$PATH"
make
shell: zsh {0}
- run: |
git status
git clean -f -d
REGISTRY=${{ steps.vars.outputs.has_creds == true && env.REGISTRY || '' }} make ${{ matrix.test-command }}
shell: zsh {0}
version: ["13", "14"]
test-command: ["test-e2e-vm-serial", "test-e2e-container"]
arch: ["X64", "arm64"]
runner-type: ["test"]
uses: ./.github/workflows/e2e-macos.yaml
secrets: inherit
with:
arch: ${{ matrix.arch }}
version: ${{ matrix.version }}
runner-type: ${{ matrix.runner-type }}
test-command: ${{ matrix.test-command }}
windows-e2e-tests:
strategy:
fail-fast: false
matrix:
os: [[self-hosted, windows, amd64, test]]
test-command: ['test-e2e-vm-serial', 'test-e2e-container']
runs-on: ${{ matrix.os }}
timeout-minutes: 180
steps:
- name: Configure git CRLF settings
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Cleanup previous checkouts
run: |
takeown /F C:\actions-runner\_work\finch /R
Remove-Item C:\actions-runner\_work\finch\finch -Recurse -Force -ErrorAction Ignore
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
# We need to get all the git tags to make version injection work. See VERSION in Makefile for more detail.
fetch-depth: 0
persist-credentials: false
submodules: recursive
- name: Set output variables
id: vars
run: |
$has_creds="${{ (github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name) && github.actor != 'dependabot[bot]'}}"
echo "has_creds=$has_creds" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
exit 0 # if $has_creds is false, powershell will exit with code 1 and this step will fail
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
if: env.has_creds == 'true'
with:
role-to-assume: ${{ secrets.ROLE }}
role-session-name: credhelper-test
aws-region: ${{ secrets.REGION }}
- name: Remove Finch VM
run: |
# We want these cleanup commands to always run, ignore errors so the step completes.
$ErrorActionPreference = 'Ignore'
taskkill /f /im wslservice.exe 2> nul || cmd /c "exit /b 0"
wsl --list --verbose
wsl --shutdown
wsl --unregister lima-finch
wsl --list --verbose
- name: Clean up previous files
run: |
Remove-Item C:\Users\Administrator\.finch -Recurse -ErrorAction Ignore
Remove-Item C:\Users\Administrator\AppData\Local\.finch -Recurse -ErrorAction Ignore
make clean
cd deps/finch-core && make clean
- name: Build project
run: |
git status
make
- name: Run e2e tests
run: |
# set path to use newer ssh version
$newPath = (";C:\Program Files\Git\bin\;" + "C:\Program Files\Git\usr\bin\;" + "$env:Path")
$env:Path = $newPath

# set networking config option to allow for VM/container -> host communication
echo "[experimental]`nnetworkingMode=mirrored`nhostAddressLoopback=true" > C:\Users\Administrator\.wslconfig
test-command: ["test-e2e-vm-serial", "test-e2e-container"]
arch: ["X64"]
runner-type: ["test"]
uses: ./.github/workflows/e2e-windows.yaml
secrets: inherit
with:
arch: ${{ matrix.arch }}
runner-type: ${{ matrix.runner-type }}
test-command: ${{ matrix.test-command }}
linux-e2e-tests:
strategy:
fail-fast: false
matrix:
os: ["amazonlinux"]
arch: ["X64", "arm64"]
version: ["2023", "2"]
test-command: ["test-e2e-container"]
runner-type: ["test"]
uses: ./.github/workflows/e2e-linux.yaml
secrets: inherit
with:
os: ${{ matrix.os }}
arch: ${{ matrix.arch }}
version: ${{ matrix.version }}
runner-type: ${{ matrix.runner-type }}
test-command: ${{ matrix.test-command }}

git status
git clean -f -d
make ${{ matrix.test-command }}
- name: Remove Finch VM and Clean Up Previous Environment
if: ${{ always() }}
run: |
# We want these cleanup commands to always run, ignore errors so the step completes.
$ErrorActionPreference = 'Ignore'
taskkill /f /im wslservice.exe 2> nul || cmd /c "exit /b 0"
wsl --list --verbose
wsl --shutdown
wsl --unregister lima-finch
wsl --list --verbose
Remove-Item C:\Users\Administrator\AppData\Local\.finch -Recurse
make clean
cd deps/finch-core && make clean
exit 0 # Cleanup may set the exit code e.g. if a file doesn't exist; just ignore
mdlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: avto-dev/markdown-lint@04d43ee9191307b50935a753da3b775ab695eceb # v1.5.0
with:
args: '**/*.md'
args: "**/*.md"
# CHANGELOG.md is only updated by release-please bot.
ignore: 'CHANGELOG.md'
ignore: "CHANGELOG.md"
104 changes: 104 additions & 0 deletions .github/workflows/e2e-linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: e2e-linux
on:
workflow_call:
inputs:
os:
type: string
required: true
arch:
type: string
required: true
version:
type: string
required: true
runner-type:
type: string
required: true
test-command:
type: string
required: true

permissions:
# This is required for configure-aws-credentials to request an OIDC JWT ID token to access AWS resources later on.
# More info: https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings
id-token: write
# This is required for actions/checkout
contents: read

jobs:
test:
runs-on:
[
"self-hosted",
"${{ inputs.os }}",
"${{ inputs.arch }}",
"${{ inputs.version }}",
"${{ inputs.runner-type }}",
]
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
# checkout uses node version 20, which doesn't run on AL2
if: ${{ ! (startsWith(inputs.os, 'amazon') && inputs.version == '2' ) }}
with:
# We need to get all the git tags to make version injection work. See VERSION in Makefile for more detail.
fetch-depth: 0
persist-credentials: false
submodules: recursive
- name: Check repo out manually
if: ${{ (startsWith(inputs.os, 'amazon') && inputs.version == '2' ) }}
run: |
pwd
echo "${GITHUB_WORKSPACE}"
ls -lah
git clone https://github.com/${GITHUB_REPOSITORY}.git .
git config --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/prh/*"
git config --add remote.origin.fetch "+refs/pull/*/merge:refs/remotes/origin/prm/*"
git fetch origin
git checkout ${GITHUB_SHA}
- name: Set output variables
id: vars
run: |
has_creds=${{ (github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name) && github.actor != 'dependabot[bot]' }}
echo "has_creds=$has_creds" >> $GITHUB_OUTPUT
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
# this action requires node20, skip on AL2
if: ${{ steps.vars.outputs.has_creds == true && (!(startsWith(inputs.os, 'amazon') && inputs.version == '2' ))}}
with:
role-to-assume: ${{ secrets.ROLE }}
role-session-name: credhelper-test
aws-region: ${{ secrets.REGION }}
- name: Clean up previous files
if: always()
run: |
sudo systemctl stop finch.service || true
sudo systemctl stop finch-buildkit.service || true
sudo systemctl stop finch-soci.service || true
sudo sudo rpm -e runfinch-finch || true
sudo systemctl daemon-reload
sudo rm -rf /etc/finch
sudo rm -rf /var/finch
sudo rm -rf /var/containerd
sudo rm -rf /var/soci-snapshotter
sudo rm -rf ./_output
- name: Build project
run: |
./contrib/packaging/rpm/build.sh --local
- name: Install Finch
run: |
sudo rpm -i ./_output/packages/$(ls -t ./_output/packages/ | grep runfinch-finch | head -1)
sudo systemctl daemon-reload
sudo systemctl start finch.service
sudo systemctl start finch-buildkit.service
sudo systemctl start finch-soci.service
- name: Run e2e tests
run: |
git status
git clean -f -d
# required by one of the tests which uses SSH_AUTH_SOCK
eval "$(ssh-agent -s)"
INSTALLED=true REGISTRY=${{ steps.vars.outputs.has_creds == true && env.REGISTRY || '' }} sudo -E make ${{ inputs.test-command }}
- name: Clean up repo AL2
if: ${{ (startsWith(inputs.os, 'amazon') && inputs.version == '2' && always() ) }}
run: |
rm -rf "${GITHUB_WORKSPACE}"
Loading
Loading