Browse Source

Fix Github Actions for Ubuntu-24.04 (#11112)

* Fix vagrant/libvirt composite action for ubuntu-24.04

* Don't ignore changes to internal actions

* Fix unit tests for ubuntu 24.04, new lsof version

* Pin os version for unit and E2E workflows

Signed-off-by: Derek Nola <derek.nola@suse.com>
pull/11102/head
Derek Nola 1 month ago committed by GitHub
parent
commit
4888376682
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      .drone.yml
  2. 8
      .github/actions/vagrant-setup/action.yaml
  3. 4
      .github/workflows/e2e.yaml
  4. 2
      .github/workflows/unitcoverage.yaml
  5. 14
      pkg/flock/flock_unix.go
  6. 17
      pkg/flock/flock_unix_test.go

2
.drone.yml

@ -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

8
.github/actions/vagrant-setup/action.yaml

@ -8,17 +8,15 @@ 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
@ -26,8 +24,6 @@ runs:
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
.github/workflows/e2e.yaml

@ -9,6 +9,7 @@ on:
- "!tests/e2e**"
- "!tests/docker**"
- ".github/**"
- "!.github/actions/**"
- "!.github/workflows/e2e.yaml"
pull_request:
paths-ignore:
@ -19,6 +20,7 @@ on:
- "!tests/e2e**"
- "!tests/docker**"
- ".github/**"
- "!.github/actions/**"
- "!.github/workflows/e2e.yaml"
workflow_dispatch: {}
@ -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

2
.github/workflows/unitcoverage.yaml

@ -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

14
pkg/flock/flock_unix.go

@ -19,9 +19,6 @@ limitations under the License.
package flock
import (
"os/exec"
"strings"
"golang.org/x/sys/unix"
)
@ -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
pkg/flock/flock_unix_test.go

@ -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()
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
@ -45,7 +58,7 @@ 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)
}
@ -53,7 +66,7 @@ func Test_UnitFlock(t *testing.T) {
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)
}
})

Loading…
Cancel
Save