Skip to content

Commit

Permalink
fix: use locking for status update (#318)
Browse files Browse the repository at this point in the history
* chore: add flakes

* chore: add locking

* fix: add locks for api ops

* chore: switch cluster status to fields

* chore: use fields instead

* chore: added some stati ctypes

* ci: add Jenkinsfile

* ci: fix jenkinsfile

* ci: remove old workflow

* ci: run as ubuntu

* ci: fix lints

* chore: fix isort

* chore: fix cluster_lock_wrapper

* create namespace early

* fix: use correct function

* don't run update_nodegroup_status with a lock

* include CA only if needed

* stop the PR body stuff

* add cluster_template_id save

* misc fixes
  • Loading branch information
mnaser authored Mar 8, 2024
1 parent 6803bd3 commit dcceec4
Show file tree
Hide file tree
Showing 16 changed files with 2,091 additions and 1,487 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
87 changes: 3 additions & 84 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ jobs:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-20.04
python-version: "3.6"
- runs-on: ubuntu-latest
python-version: "3.7"
- runs-on: ubuntu-latest
python-version: "3.8"
- runs-on: ubuntu-latest
Expand Down Expand Up @@ -51,15 +47,15 @@ jobs:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-20.04
openstack-version: yoga
python-version: "3.6"
- runs-on: ubuntu-latest
python-version: "3.8"
openstack-version: zed
- runs-on: ubuntu-latest
python-version: "3.8"
openstack-version: "2023.1"
- runs-on: ubuntu-latest
python-version: "3.10"
openstack-version: "2023.2"
steps:
- name: Checkout project
uses: actions/checkout@v3
Expand Down Expand Up @@ -114,10 +110,6 @@ jobs:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-20.04
python-version: "3.6"
- runs-on: ubuntu-latest
python-version: "3.7"
- runs-on: ubuntu-latest
python-version: "3.8"
- runs-on: ubuntu-latest
Expand Down Expand Up @@ -184,76 +176,3 @@ jobs:
with:
name: ${{ matrix.os_distro }}-kube-${{ matrix.kube }}.qcow2
path: ${{ matrix.os_distro }}-kube-${{ matrix.kube }}.qcow2

functional:
runs-on: v3-standard-16
strategy:
fail-fast: false
matrix:
os_distro:
- ubuntu-2204
- flatcar
kube:
- v1.26.11
- v1.27.8
concurrency:
group: functional-${{ github.ref }}-${{ matrix.kube }}-${{ matrix.os_distro }}
cancel-in-progress: true
steps:
- name: Checkout project
uses: actions/checkout@v3

- name: Clean-up node
run: sudo apt-get purge -y postgresql* mysql-*

- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Install Magnum with Cluster API
run: ./hack/stack.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Wait for images
if: contains(github.event.pull_request.body, '/build-new-image')
uses: lewagon/wait-on-check-action@v1.3.1
with:
ref: ${{ github.event.pull_request.head.sha }}
check-name: "build-images (${{ matrix.os_distro }}, ${{ matrix.kube }})"
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10

- name: Download built image
if: contains(github.event.pull_request.body, '/build-new-image')
uses: actions/download-artifact@v3
with:
name: ${{ matrix.os_distro }}-kube-${{ matrix.kube }}.qcow2

- name: Update environment variables for GitHub Hosted Runners
if: contains(runner.name, 'GitHub Actions')
run: |
echo "DNS_NAMESERVER=168.63.129.16" >> $GITHUB_ENV
- name: Run functional tests
run: |
./hack/run-functional-tests.sh
env:
BUILD_NEW_IMAGE: "${{ contains(github.event.pull_request.body, '/build-new-image') }}"
OS_DISTRO: "${{ matrix.os_distro }}"
KUBE_TAG: "${{ matrix.kube }}"
NODE_COUNT: 2

- name: Setup "tmate" session
if: github.event_name == 'workflow_dispatch' && inputs.debug_enabled && failure()
uses: mxschmitt/action-tmate@v3

- name: Upload Sonobuoy results
uses: actions/upload-artifact@v3
if: always()
continue-on-error: true
with:
name: "sonobuoy-results-${{ matrix.kube }}"
path: sonobuoy-results.tar.gz
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.direnv
__pycache__
dist
magnum_cluster_api/charts/*
!magnum_cluster_api/charts/.gitkeep
!magnum_cluster_api/charts/k8s-keystone-auth
site
site
58 changes: 58 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
pipeline {
agent none

options {
disableConcurrentBuilds(abortPrevious: true);
}

stages {
stage('functional') {
matrix {
axes {
axis {
name 'OS_DISTRO'
values 'flatcar', 'ubuntu-2204'
}

axis {
name 'KUBE_TAG'
values 'v1.26.11', 'v1.27.8'
}
}

agent {
label 'jammy-16c-64g'
}

stages {
stage('sonobuoy') {
steps {
sh './hack/stack.sh'

// TODO: Wait for built artifacts
// TODO: Download built image

script {
env.KUBE_TAG = "${KUBE_TAG}"
env.NODE_COUNT = 2
env.OS_DISTRO = "${OS_DISTRO}"

// if (pullRequest.body.contains('/build-new-image')) {
// env.BUILD_NEW_IMAGE = 'true'
// }

sh './hack/run-functional-tests.sh'
}
}
}
}

post {
always {
archiveArtifacts artifacts: 'sonobuoy-results.tar.gz', allowEmptyArchive: true
}
}
}
}
}
}
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs {
inherit system;
};
in
{
devShell = pkgs.mkShell
{
# LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib";

buildInputs = with pkgs; [
poetry
];
};
}
);
}
Loading

0 comments on commit dcceec4

Please sign in to comment.