Skip to content

Commit

Permalink
[REMOVE BEFORE FLIGH] Local snap installation
Browse files Browse the repository at this point in the history
  • Loading branch information
juditnovak committed Dec 3, 2023
1 parent 1a24325 commit 4f04de2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
15 changes: 13 additions & 2 deletions src/opensearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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}")
Expand Down

0 comments on commit 4f04de2

Please sign in to comment.