diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index d008cba58..ee79b3b6b 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -19,9 +19,30 @@ jobs: name: Build charms uses: canonical/data-platform-workflows/.github/workflows/build_charms_with_cache.yaml@v2 + build-snap: + name: Build snap + runs-on: ubuntu-latest + outputs: + snap-file: ${{ steps.build-snap.outputs.snap }} + steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 + repository: canonical/opensearch-snap + - id: build-snap + name: Build snap + uses: snapcore/action-build@v1 + with: + snapcraft-channel: 7.x/candidate + - name: Copy snap + run: | + cp ${{ steps.build-snap.outputs.snap }} src/ + integration-test: needs: - build + - build-snap strategy: fail-fast: false matrix: diff --git a/src/opensearch.py b/src/opensearch.py index 0db342b0d..40a1f3a1a 100644 --- a/src/opensearch.py +++ b/src/opensearch.py @@ -25,7 +25,7 @@ ) from charms.operator_libs_linux.v1.systemd import service_failed from charms.operator_libs_linux.v2 import snap -from charms.operator_libs_linux.v2.snap import SnapError +from charms.operator_libs_linux.v2.snap import SnapError, install_local from overrides import override from tenacity import Retrying, retry, stop_after_attempt, wait_exponential, wait_fixed @@ -61,7 +61,18 @@ def install(self): if self._opensearch.present: return try: - self._opensearch.ensure(snap.SnapState.Latest, channel="edge") + # DON'T COMMIT LIKE THIS + # TEMP MEASURE UNTIL NEW SNAP IS AVAIL + # i.e. https://github.com/canonical/opensearch-snap/pull/45 MERGED + # BEGIN + install_local("./src/opensearch_2.10.0_amd64.snap", classic=True, dangerous=True) + self._opensearch.connect("log-observe") + self._opensearch.connect("mount-observe") + self._opensearch.connect("system-observe") + self._opensearch.connect("sys-fs-cgroup-service") + # END + + # self._opensearch.ensure(snap.SnapState.Latest, channel="edge") self._opensearch.connect("process-control") except SnapError as e: logger.error(f"Failed to install opensearch. \n{e}")