diff --git a/.github/workflows/_integration.yml b/.github/workflows/_integration.yml index 5ea461c2..f8e82306 100644 --- a/.github/workflows/_integration.yml +++ b/.github/workflows/_integration.yml @@ -39,10 +39,7 @@ jobs: fail-fast: false matrix: juju-channel: ["3.6/stable"] - scenario: ["tls_full", "tls_external", "tls_internal", "tls_none"] - include: - - juju-channel: "4.1/beta" - scenario: "juju_4" + scenario: ["tls_none"] steps: - name: Checkout uses: actions/checkout@v4 @@ -51,6 +48,7 @@ jobs: run: | sudo snap install concierge --classic sudo concierge prepare --juju-channel ${{ matrix.juju-channel }} -p microk8s --extra-snaps just,astral-uv,terraform + sudo concierge prepare --juju-channel ${{ matrix.juju-channel }} -p machine # Setup for Self-hosted (PS7) runners - name: Install snaps @@ -60,6 +58,11 @@ jobs: sudo snap install just --classic sudo snap install astral-uv --classic sudo snap install terraform --classic + - name: Concierge prepare machine + if: ${{ runner.environment == 'self-hosted' }} + run: | + sudo snap install concierge --classic + sudo concierge prepare --juju-channel ${{ matrix.juju-channel }} -p machine - name: (IS hosted) Configure microk8s Docker Hub mirror timeout-minutes: 10 if: ${{ runner.environment == 'self-hosted' }} @@ -117,39 +120,11 @@ jobs: mkdir -p ~/.local/share/juju # Workaround for juju 3 strict snap sudo --user "$USER" --preserve-env --preserve-env=PATH -- env -- juju bootstrap microk8s --config model-logs-size=10G microk8s juju model-defaults logging-config='=INFO; unit=DEBUG' - - # Runner-independent setup - - name: Install and configure microceph - if: ${{ inputs.product == 'cos' }} - run: | - # https://github.com/canonical/microceph-action/blob/main/microceph.sh - function check_ceph_ok_or_exit () { - i=0 - for i in {1..5}; do - if sudo microceph.ceph status | grep HEALTH_OK; then - break - else - sudo microceph.ceph status - sleep 30 - sudo microceph.ceph health detail - fi - done - if [ "$i" -eq 5 ]; then - exit 1 - fi - } - - sudo snap install microceph - sudo microceph cluster bootstrap - sleep 30s - sudo microceph.ceph config set "mon.$(hostname)" mon_data_avail_warn 6 - sudo microceph disk add loop,2G,3 - check_ceph_ok_or_exit - - sudo microceph enable rgw --port 8080 --ssl-port 8443 - sudo microceph.radosgw-admin user create --uid=user --display-name=User - sudo microceph.radosgw-admin key create --uid=user --key-type=s3 --access-key=access-key --secret-key=secret-key - + - name: Open SSH session on failure + uses: mxschmitt/action-tmate@v3 + with: + connect-timeout-seconds: 3600 + limit-access-to-actor: true - name: Test deployment run: | if [[ "${{ inputs.product }}" == "cos" ]]; then @@ -169,5 +144,5 @@ jobs: if: ${{ failure() && (runner.debug == '1') }} uses: mxschmitt/action-tmate@v3 with: - timeout-minutes: 30 + connect-timeout-seconds: 3600 limit-access-to-actor: true diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index 7164cc25..d9773da4 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -8,56 +8,6 @@ on: - "tests/integration/**" jobs: - lint-terraform: - name: Terraform lint - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install dependencies - run: | - sudo snap install terraform --classic - sudo snap install just --classic - - name: Lint the Terraform modules - run: just lint-terraform - lint-terraform-docs: - name: Lint terraform docs - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install dependencies - run: | - sudo snap install terraform --classic - sudo snap install terraform-docs - sudo snap install just --classic - - name: Lint the Terraform docs - run: just lint-terraform-docs - validate-terraform: - name: Terraform validate - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install dependencies - run: | - sudo snap install terraform --classic - sudo snap install just --classic - - name: Validate the Terraform modules - run: just validate-terraform - test-unit: - name: Terraform unit tests - needs: [lint-terraform, lint-terraform-docs, validate-terraform] - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install dependencies - run: | - sudo snap install terraform --classic - sudo snap install just --classic - - name: Unit test the Terraform modules - run: just unit changes: name: Detect changed products runs-on: ubuntu-latest @@ -73,7 +23,7 @@ jobs: id: filter with: filters: | - # Shared paths affect *both* products, so they trigger both suites + # Shared paths affect *multiple* products, so they trigger as well shared: &shared - '.github/workflows/terraform.yml' - '.github/workflows/_integration.yml' @@ -91,27 +41,11 @@ jobs: - *shared - 'terraform/cos-dev/**' - 'tests/integration/cos_dev/**' - test-integration-cos-lite: - name: COS Lite Terraform integration - needs: [test-unit, changes] - if: ${{ github.event_name == 'workflow_dispatch' || needs.changes.outputs.cos_lite == 'true' }} - uses: canonical/observability-stack/.github/workflows/_integration.yml@main - with: - product: cos_lite - runner: self-hosted-linux-amd64-noble-large test-integration-cos: name: COS Terraform integration - needs: [test-unit, changes] + if: ${{ github.event_name == 'workflow_dispatch' || needs.changes.outputs.cos == 'true' }} - uses: canonical/observability-stack/.github/workflows/_integration.yml@main + uses: canonical/observability-stack/.github/workflows/_integration.yml@feat/ceph-charm with: product: cos - runner: self-hosted-linux-amd64-noble-xlarge - test-integration-cos-dev: - name: COS Dev Terraform integration - needs: [test-unit, changes] - if: ${{ github.event_name == 'workflow_dispatch' || needs.changes.outputs.cos_dev == 'true' }} - uses: canonical/observability-stack/.github/workflows/_integration.yml@main - with: - product: cos_dev - runner: self-hosted-linux-amd64-noble-large \ No newline at end of file + runner: self-hosted-linux-amd64-noble-xlarge \ No newline at end of file diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 91f492e5..4cd17087 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -28,16 +28,23 @@ def _keep_models(request) -> bool: @pytest.fixture(scope="module") def ca_model(request): - with jubilant.temp_model(keep=_keep_models(request)) as juju: + # TODO: Set the name of the controller in concierge to "microk8s" since we have 2 paths: self-hosted and GH hosted which will break this. + # This will also break local testing if the controller is not named "microk8s" + with jubilant.temp_model(keep=_keep_models(request), controller="microk8s") as juju: yield juju @pytest.fixture(scope="module") def cos_model(request): - with jubilant.temp_model(keep=_keep_models(request)) as juju: + with jubilant.temp_model(keep=_keep_models(request), controller="microk8s") as juju: yield juju +@pytest.fixture(scope="module") +def machine_model(request): + with jubilant.temp_model(keep=_keep_models(request), controller="concierge-lxd") as juju: + yield juju + @pytest.fixture(scope="module") def tf_manager(tmp_path_factory): base = tmp_path_factory.mktemp("terraform_base")