Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/509-remove-…
Browse files Browse the repository at this point in the history
…deprecated-version
  • Loading branch information
pnoltes committed Jan 13, 2024
2 parents fce59ed + a800c42 commit 47b2f76
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 35 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Celix development containers

on:
push:
pull_request:
schedule:
- cron: '0 0 * * 0' # Weekly on Sunday at 00:00 UTC

jobs:
container-build-ubuntu:
runs-on: ubuntu-22.04
timeout-minutes: 120
steps:
- name: Checkout source code
uses: actions/[email protected]
- name: Build container image
run: |
cd $GITHUB_WORKSPACE/container/
./build-ubuntu-container.sh
- name: Build Celix using container image
run: |
cd $GITHUB_WORKSPACE/container/
./run-ubuntu-container.sh "mkdir -p build && cd build && ../container/support-scripts/build-all.sh && make -j"
- name: Run Celix tests using container image
run: |
cd $GITHUB_WORKSPACE/container/
./run-ubuntu-container.sh "cd build && ctest --output-on-failure"
container-build-gitpod:
runs-on: ubuntu-22.04
timeout-minutes: 120
steps:
- name: Checkout source code
uses: actions/[email protected]
- name: Build container image
run: |
cd $GITHUB_WORKSPACE/container/
docker build -t apache/celix-dev:gitpod-latest -f Containerfile.gitpod .
3 changes: 0 additions & 3 deletions container/Containerfile.gitpod
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
# specific language governing permissions and limitations
# under the License.

# SSH credentials:
# root@password

FROM docker.io/gitpod/workspace-full:2023-10-06-16-22-14@sha256:76d3041cc7a2caa00d6f4610ace0e15009c361515f3d5d9ee6690e4019adcfd4

# Switch to root user to install dependencies and configure sshd
Expand Down
11 changes: 5 additions & 6 deletions container/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ To always be able to develop on Celix with an up-to-date image, built the image
cd <project-root>

# Start a local container with the SSH daemon running
./container/start-ubuntu-container.sh
./container/run-ubuntu-container.sh
```

Now connect to the container via the remote container option of your favoured IDE and start building/developing.
Expand All @@ -35,22 +35,21 @@ When finished with development and testing, press `CTRL + \` to stop the SSH dae

### Start locally with only a bash shell

The start script allows passing of additional paramters, which will override the starting of the SSH daemon.
The start script allows passing of additional parameters, which will override the starting of the SSH daemon.
Execute the following commands to open a bash shell and build Celix from the command line:

```bash
cd <project-root>

# Start a local container and open a bash shell
./container/start-ubuntu-container.sh bash
./container/run-ubuntu-container.sh bash

# Build Apache Celix
mkdir celix-build
cd celix-build
mkdir -p build
cd build
../container/support-scripts/build-all.sh
make -j

# Run the unit tests for Apache Celix
ctest --output-on-failure
```

1 change: 0 additions & 1 deletion container/build-ubuntu-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ fi

cd "${SCRIPT_LOCATION}"
${CONTAINER_ENGINE} build -t apache/celix-dev:ubuntu-latest -f Containerfile.ubuntu .

Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,4 @@ ${CONTAINER_ENGINE} run -it --rm --privileged \
--volume "${CELIX_REPO_ROOT}":"${CELIX_REPO_ROOT}" \
--workdir "${CELIX_REPO_ROOT}" \
--security-opt label=disable \
apache/celix-dev:ubuntu-latest ${CONTAINER_COMMAND}

apache/celix-dev:ubuntu-latest bash -c "${CONTAINER_COMMAND}"
1 change: 0 additions & 1 deletion container/support-scripts/build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DRSA_SHM=ON \
-DRSA_REMOTE_SERVICE_ADMIN_SHM_V2=ON \
..

37 changes: 15 additions & 22 deletions libs/framework/src/service_registry.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,37 +677,30 @@ size_t serviceRegistry_nrOfHooks(service_registry_pt registry) {
}

static celix_status_t serviceRegistry_getUsingBundles(service_registry_pt registry, service_registration_pt registration, celix_array_list_t** out) {
celix_status_t status = CELIX_SUCCESS;
celix_array_list_t* bundles = NULL;
hash_map_iterator_pt iter;

bundles = celix_arrayList_create();
if (bundles) {
celixThreadRwlock_readLock(&registry->lock);
iter = hashMapIterator_create(registry->serviceReferences);
while (hashMapIterator_hasNext(iter)) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
bundle_pt registrationUser = hashMapEntry_getKey(entry);
hash_map_pt regMap = hashMapEntry_getValue(entry);
if (hashMap_containsKey(regMap, (void*)registration->serviceId)) {
celix_arrayList_add(bundles, registrationUser);
}
}
hashMapIterator_destroy(iter);
celixThreadRwlock_unlock(&registry->lock);
} else {
status = CELIX_ENOMEM;
if (bundles == NULL) {
return CELIX_ENOMEM;
}

if (status == CELIX_SUCCESS) {
*out = bundles;
} else {
if (bundles != NULL) {
celix_arrayList_destroy(bundles);
celixThreadRwlock_readLock(&registry->lock);
iter = hashMapIterator_create(registry->serviceReferences);
while (hashMapIterator_hasNext(iter)) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
bundle_pt registrationUser = hashMapEntry_getKey(entry);
hash_map_pt regMap = hashMapEntry_getValue(entry);
if (hashMap_containsKey(regMap, (void*)registration->serviceId)) {
celix_arrayList_add(bundles, registrationUser);
}
}
hashMapIterator_destroy(iter);
celixThreadRwlock_unlock(&registry->lock);

return status;
*out = bundles;

return CELIX_SUCCESS;
}

celix_status_t
Expand Down

0 comments on commit 47b2f76

Please sign in to comment.