Skip to content

Commit

Permalink
update charm code
Browse files Browse the repository at this point in the history
  • Loading branch information
kelkawi-a committed Oct 10, 2024
1 parent a85b6cf commit c922b45
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
integration-tests:
uses: kelkawi-a/operator-workflows/.github/workflows/integration_test.yaml@fc96d4589130d5cfdb96a1116b7284c3780d5fa5
uses: kelkawi-a/operator-workflows/.github/workflows/integration_test.yaml@2119d8c5890abff0db8ba00ffcbaa9549f6fec95
secrets: inherit
with:
channel: 1.28-strict/stable
Expand Down
29 changes: 10 additions & 19 deletions airbyte_rock/rockcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,37 @@ services:
override: replace
summary: "airbyte-server service"
startup: enabled
command: "/bin/bash -c airbyte-server/bin/airbyte-server"
command: "/bin/bash -c airbyte-server/airbyte-app/bin/airbyte-server"
airbyte-workers:
override: replace
summary: "airbyte-workers service"
startup: enabled
command: "/bin/bash -c airbyte-workers/bin/airbyte-workers"
command: "/bin/bash -c airbyte-workers/airbyte-app/bin/airbyte-workers"
airbyte-api-server:
override: replace
summary: "airbyte-api-server service"
startup: enabled
command: "/bin/bash -c airbyte-api-server/bin/airbyte-api-server"
command: "/bin/bash -c airbyte-api-server/airbyte-app/bin/airbyte-api-server"
airbyte-bootloader:
override: replace
summary: "airbyte-bootloader service"
startup: enabled
command: "/bin/bash -c airbyte-bootloader/bin/airbyte-bootloader"
command: "/bin/bash -c airbyte-bootloader/airbyte-app/bin/airbyte-bootloader"
airbyte-connector-builder-server:
override: replace
summary: "airbyte-connector-builder-server service"
startup: enabled
command: "/bin/bash -c airbyte-connector-builder-server/bin/airbyte-connector-builder-server"
command: "/bin/bash -c airbyte-connector-builder-server/airbyte-app/bin/airbyte-connector-builder-server"
airbyte-cron:
override: replace
summary: "airbyte-cron service"
startup: enabled
command: "/bin/bash -c airbyte-cron/bin/airbyte-cron"
command: "/bin/bash -c airbyte-cron/airbyte-app/bin/airbyte-cron"
airbyte-pod-sweeper:
override: replace
summary: "airbyte-pod-sweeper service"
startup: enabled
command: "/bin/bash -c airbyte-pod-sweeper/bin/airbyte-pod-sweeper"
command: "/bin/bash -c airbyte-pod-sweeper/airbyte-app/bin/airbyte-pod-sweeper"

environment:
JAVA_HOME: /usr/lib/jvm/java-21-openjdk-amd64
Expand Down Expand Up @@ -121,20 +121,11 @@ parts:
plugin: dump
source: ./local-files
organize:
pod-sweeper.sh: airbyte-pod-sweeper/bin/airbyte-pod-sweeper.sh
pod-sweeper.sh: airbyte-pod-sweeper/airbyte-app/bin/airbyte-pod-sweeper.sh
stage:
- airbyte-pod-sweeper/bin/airbyte-pod-sweeper.sh
- airbyte-pod-sweeper/airbyte-app/bin/airbyte-pod-sweeper.sh
permissions:
- path: airbyte-pod-sweeper/bin/airbyte-pod-sweeper.sh
- path: airbyte-pod-sweeper/airbyte-app/bin/airbyte-pod-sweeper.sh
owner: 584792
group: 584792
mode: "755"

# ./gradlew distTar -x dockerBuildImage
# ./gradlew distTar -x dockerBuildImage -x :airbyte-db:jooq:generateConfigsDatabaseJooq -x :airbyte-db:jooq:generateJobsDatabaseJooq
# ./gradlew :airbyte-server:distTar -x dockerBuildImage -x :airbyte-db:jooq:generateConfigsDatabaseJooq -x :airbyte-db:jooq:generateJobsDatabaseJooq -x :airbyte-data:kaptGenerateStubsKotlin
# ./gradlew :airbyte-api-server:distTar -x dockerBuildImage -x :airbyte-db:jooq:generateConfigsDatabaseJooq -x :airbyte-db:jooq:generateJobsDatabaseJooq -x :airbyte-data:kaptGenerateStubsKotlin
# ./gradlew :airbyte-workers:distTar -x dockerBuildImage -x :airbyte-db:jooq:generateConfigsDatabaseJooq -x :airbyte-db:jooq:generateJobsDatabaseJooq -x :airbyte-data:kaptGenerateStubsKotlin
# ./gradlew :airbyte-bootloader:distTar -x dockerBuildImage -x :airbyte-db:jooq:generateConfigsDatabaseJooq -x :airbyte-db:jooq:generateJobsDatabaseJooq -x :airbyte-data:kaptGenerateStubsKotlin
# ./gradlew :airbyte-cron:distTar -x dockerBuildImage -x :airbyte-db:jooq:generateConfigsDatabaseJooq -x :airbyte-db:jooq:generateJobsDatabaseJooq -x :airbyte-data:kaptGenerateStubsKotlin
# ./gradlew :airbyte-connector-builder-server:distTar -x dockerBuildImage -x :airbyte-db:jooq:generateConfigsDatabaseJooq -x :airbyte-db:jooq:generateJobsDatabaseJooq -x :airbyte-data:kaptGenerateStubsKotlin
57 changes: 30 additions & 27 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -429,40 +429,43 @@ config:
# Your workload’s containers.
containers:
airbyte-api-server:
resource: airbyte-api-server
resource: airbyte-image
airbyte-bootloader:
resource: airbyte-bootloader
resource: airbyte-image
airbyte-connector-builder-server:
resource: airbyte-connector-builder-server
resource: airbyte-image
airbyte-cron:
resource: airbyte-cron
resource: airbyte-image
airbyte-pod-sweeper:
resource: airbyte-pod-sweeper
resource: airbyte-image
airbyte-server:
resource: airbyte-server
resource: airbyte-image
airbyte-workers:
resource: airbyte-workers
resource: airbyte-image

# This field populates the Resources tab on Charmhub.
resources:
airbyte-api-server:
type: oci-image
description: OCI image for Airbyte API server
airbyte-bootloader:
type: oci-image
description: OCI image for Airbyte Bootloader
airbyte-connector-builder-server:
type: oci-image
description: OCI image for Airbyte Connector Builder Server
airbyte-cron:
type: oci-image
description: OCI image for Airbyte Cron
airbyte-pod-sweeper:
type: oci-image
description: OCI image for Airbyte Pod Sweeper
airbyte-server:
type: oci-image
description: OCI image for Airbyte Server
airbyte-workers:
airbyte-image:
type: oci-image
description: OCI image for Airbyte Worker
description: OCI image for Airbyte
# airbyte-api-server:
# type: oci-image
# description: OCI image for Airbyte API server
# airbyte-bootloader:
# type: oci-image
# description: OCI image for Airbyte Bootloader
# airbyte-connector-builder-server:
# type: oci-image
# description: OCI image for Airbyte Connector Builder Server
# airbyte-cron:
# type: oci-image
# description: OCI image for Airbyte Cron
# airbyte-pod-sweeper:
# type: oci-image
# description: OCI image for Airbyte Pod Sweeper
# airbyte-server:
# type: oci-image
# description: OCI image for Airbyte Server
# airbyte-workers:
# type: oci-image
# description: OCI image for Airbyte Worker
2 changes: 1 addition & 1 deletion src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def get_pebble_layer(application_name, context):
"services": {
application_name: {
"summary": application_name,
"command": f"/bin/bash -c {application_name}/bin/{application_name}",
"command": f"/bin/bash -c {application_name}/airbyte-app/bin/{application_name}",
"startup": "enabled",
"override": "replace",
# Including config values here so that a change in the
Expand Down
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ def pytest_addoption(parser: pytest.Parser):
"""
# The prebuilt charm file.
parser.addoption("--charm-file", action="append", default=[])
# The charm image name:tag.
parser.addoption("--airbyte-image", action="store", default="")
15 changes: 12 additions & 3 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
import logging
from pathlib import Path

import pytest
import pytest_asyncio
from helpers import (
APP_NAME_AIRBYTE_SERVER,
APP_NAME_TEMPORAL_ADMIN,
APP_NAME_TEMPORAL_SERVER,
create_default_namespace,
get_airbyte_charm_resources,
perform_airbyte_integrations,
perform_temporal_integrations,
run_sample_workflow,
Expand All @@ -23,6 +23,14 @@
logger = logging.getLogger(__name__)


@pytest.fixture(scope="module", name="charm_image")
def charm_image_fixture(request: FixtureRequest) -> str:
"""The OCI image for charm."""
charm_image = request.config.getoption("--airbyte-image")
assert charm_image, "--airbyte-image argument is required which should contain the name of the OCI image."
return charm_image


@pytest_asyncio.fixture(scope="module", name="charm")
async def charm_fixture(request: FixtureRequest, ops_test: OpsTest) -> str | Path:
"""Fetch the path to charm."""
Expand All @@ -35,10 +43,11 @@ async def charm_fixture(request: FixtureRequest, ops_test: OpsTest) -> str | Pat


@pytest_asyncio.fixture(name="deploy", scope="module")
async def deploy(ops_test: OpsTest, charm: str):
async def deploy(ops_test: OpsTest, charm: str, charm_image: str):
"""Test the app is up and running."""
await ops_test.model.set_config({"update-status-hook-interval": "1m"})
resources = get_airbyte_charm_resources()
# resources = get_airbyte_charm_resources()
resources = {"airbyte-image": charm_image}

await ops_test.model.deploy(charm, resources=resources, application_name=APP_NAME_AIRBYTE_SERVER, trust=True)
await ops_test.model.deploy(
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def create_plan(container_name, storage_type):
"services": {
container_name: {
"summary": container_name,
"command": f"/bin/bash -c {container_name}/bin/{container_name}",
"command": f"/bin/bash -c {container_name}/airbyte-app/bin/{container_name}",
"startup": "enabled",
"override": "replace",
"environment": {
Expand Down

0 comments on commit c922b45

Please sign in to comment.