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

Fix Github Actions for Ubuntu-24.04 #11112

Merged
merged 6 commits into from
Oct 16, 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
2 changes: 1 addition & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ steps:
UPGRADE_CHANNEL="latest"
fi
fi
E2E_RELEASE_CHANNEL=$UPGRADE_CHANNEL go test -v -timeout=45m ./upgradecluster_test.go -ci -local
E2E_RELEASE_CHANNEL=$UPGRADE_CHANNEL go test -v -timeout=45m ./upgradecluster_test.go -ci -local -ginkgo.v
cp ./coverage.out /tmp/artifacts/upgrade-coverage.out
fi
- docker stop registry && docker rm registry
Expand Down
8 changes: 2 additions & 6 deletions .github/actions/vagrant-setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,22 @@ runs:
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 apt-get install -y libvirt-daemon libvirt-daemon-system vagrant ruby-libvirt
sudo systemctl enable --now libvirtd
- name: Build vagrant dependencies
- name: Install 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
4 changes: 3 additions & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- "!tests/e2e**"
- "!tests/docker**"
- ".github/**"
- "!.github/actions/**"
- "!.github/workflows/e2e.yaml"
pull_request:
paths-ignore:
Expand All @@ -19,6 +20,7 @@ on:
- "!tests/e2e**"
- "!tests/docker**"
- ".github/**"
- "!.github/actions/**"
- "!.github/workflows/e2e.yaml"
workflow_dispatch: {}

Expand All @@ -33,7 +35,7 @@ jobs:
e2e:
name: "E2E Tests"
needs: build
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
timeout-minutes: 40
strategy:
fail-fast: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unitcoverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ permissions:
jobs:
test:
name: Unit Tests
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- name: Checkout
Expand Down
14 changes: 0 additions & 14 deletions pkg/flock/flock_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ limitations under the License.
package flock

import (
"os/exec"
"strings"

"golang.org/x/sys/unix"
)

Expand Down Expand Up @@ -49,14 +46,3 @@ func AcquireShared(path string) (int, error) {
func Release(lock int) error {
return unix.Flock(lock, unix.LOCK_UN)
}

// CheckLock checks whether any process is using the lock
func CheckLock(path string) bool {
lockByte, _ := exec.Command("lsof", "-w", "-F", "ln", path).Output()
locks := string(lockByte)
if locks == "" {
return false
}
readWriteLock := strings.Split(locks, "\n")[2]
return readWriteLock == "lR" || readWriteLock == "lW"
}
17 changes: 15 additions & 2 deletions pkg/flock/flock_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,22 @@ limitations under the License.
package flock

import (
"os/exec"
"strings"
"testing"
)

// checkLock checks whether any process is using the lock
func checkLock(path string) bool {
lockByte, _ := exec.Command("lsof", "-w", "-F", "lfn", path).Output()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we check for the error here? and return false if err != nil ?

locks := string(lockByte)
if locks == "" {
return false
}
readWriteLock := strings.Split(locks, "\n")[2]
return readWriteLock == "lR" || readWriteLock == "lW"
}

func Test_UnitFlock(t *testing.T) {
tests := []struct {
name string
Expand All @@ -45,15 +58,15 @@ func Test_UnitFlock(t *testing.T) {
return
}

if got := CheckLock(tt.path); got != tt.wantCheck {
if got := checkLock(tt.path); got != tt.wantCheck {
t.Errorf("CheckLock() = %+v\nWant = %+v", got, tt.wantCheck)
}

if err := Release(lock); (err != nil) != tt.wantErr {
t.Errorf("Release() error = %v, wantErr %v", err, tt.wantErr)
}

if got := CheckLock(tt.path); got == tt.wantCheck {
if got := checkLock(tt.path); got == tt.wantCheck {
t.Errorf("CheckLock() = %+v\nWant = %+v", got, !tt.wantCheck)
}
})
Expand Down
Loading