-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[3.2.1 backport] CBG-4294 recognize alma/rocky linux
- Loading branch information
Showing
6 changed files
with
168 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Copyright 2022-Present Couchbase, Inc. | ||
# | ||
# Use of this software is governed by the Business Source License included in | ||
# the file licenses/BSL-Couchbase.txt. As of the Change Date specified in that | ||
# file, in accordance with the Business Source License, use of this software | ||
# will be governed by the Apache License, Version 2.0, included in the file | ||
# licenses/APL2.txt. | ||
|
||
name: service | ||
|
||
on: | ||
push: | ||
# Only run when we modify service files | ||
paths: | ||
- 'service/**' | ||
- 'integration-test/**' | ||
branches: | ||
- 'main' | ||
- 'release/*' | ||
- 'feature/*' | ||
- 'beryllium' | ||
- 'CBG*' | ||
- 'ci-*' | ||
- 'api-ci-*' | ||
pull_request: | ||
# Only run when we modify service files | ||
paths: | ||
- 'service/**' | ||
- 'integration-test/**' | ||
branches: | ||
- 'main' | ||
- 'release/*' | ||
|
||
jobs: | ||
scripts: | ||
runs-on: ubuntu-latest | ||
name: Verify service script installation. | ||
steps: | ||
- uses: actions/checkout@v4 | ||
# build sync gateway since the executable is needed for service installation | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22.5 | ||
- name: "Build Sync Gateway" | ||
run: mkdir -p ./bin && go build -o ./bin ./... | ||
- name: "Run test scripts" | ||
run: ./integration-test/service-install-tests.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
# Copyright 2024-Present Couchbase, Inc. | ||
# | ||
# Use of this software is governed by the Business Source License included | ||
# in the file licenses/BSL-Couchbase.txt. As of the Change Date specified | ||
# in that file, in accordance with the Business Source License, use of this | ||
# software will be governed by the Apache License, Version 2.0, included in | ||
# the file licenses/APL2.txt. | ||
|
||
# This file is used by github CI or locally and runs a subset of test scripts to validate the service installation done by the package managers. This is intended to be run from Linux or Mac. | ||
|
||
set -eux -o pipefail | ||
|
||
IMAGES=( | ||
"almalinux:9" | ||
"amazonlinux:2" | ||
"amazonlinux:2023" | ||
"debian:10" | ||
"debian:11" | ||
"debian:12" | ||
"redhat/ubi8" | ||
"redhat/ubi9" | ||
"rockylinux:9" | ||
"ubuntu:20.04" | ||
"ubuntu:22.04" | ||
"ubuntu:24.04" | ||
|
||
# not technically supported | ||
"oraclelinux:9" | ||
) | ||
|
||
SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}") | ||
SYNC_GATEWAY_DIR=$(realpath ${SCRIPT_DIR}/..) | ||
|
||
if [ "$(uname)" == "Darwin" ]; then | ||
sudo ${SYNC_GATEWAY_DIR}/integration-test/service-test.sh | ||
fi | ||
|
||
for IMAGE in "${IMAGES[@]}"; do | ||
echo "Running tests for ${IMAGE}" | ||
docker run --mount src=${SYNC_GATEWAY_DIR},target=/sync_gateway,type=bind ${IMAGE} /bin/bash -c "/sync_gateway/integration-test/service-test.sh" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#/bin/sh | ||
|
||
# Copyright 2024-Present Couchbase, Inc. | ||
# | ||
# Use of this software is governed by the Business Source License included | ||
# in the file licenses/BSL-Couchbase.txt. As of the Change Date specified | ||
# in that file, in accordance with the Business Source License, use of this | ||
# software will be governed by the Apache License, Version 2.0, included in | ||
# the file licenses/APL2.txt. | ||
|
||
# This code is intneded to be run from within a docker container of a specific platform and runs a subset of the service scripts. The full service can not be validated since systemd does not work in docker contains. This is intended to run in /bin/sh to test dash environments on debian systems. | ||
|
||
set -eux -o pipefail | ||
|
||
SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}") | ||
|
||
cd ${SCRIPT_DIR}/../service | ||
|
||
./sync_gateway_service_install.sh --servicecmd | ||
|
||
# /etc/os-release doesn't exist on Darwin | ||
if [ -f /etc/os-release ]; then | ||
. /etc/os-release | ||
case ${ID} in | ||
amzn) | ||
yum install -y shadow-utils systemd | ||
;; | ||
esac | ||
|
||
groupadd -r sync_gateway | ||
useradd -g sync_gateway sync_gateway | ||
|
||
# bash would support export -f for a systemctl wrapper, but dash does not support exporting aliases or functions | ||
|
||
mkdir -p /tmp/systemctl_wrapper | ||
|
||
cat << 'EOF' > /tmp/systemctl_wrapper/systemctl | ||
#!/bin/bash | ||
set -eu -o pipefail | ||
case ${1:-} in | ||
start) | ||
echo "No-op systemctl start in docker, since we're not running systemd" | ||
;; | ||
stop) | ||
echo "No-op systemctl stop in docker, since we're not running systemd" | ||
;; | ||
*) | ||
echo "Running systemctl $@" | ||
command /usr/bin/systemctl "$@" | ||
;; | ||
esac | ||
EOF | ||
|
||
chmod +x /tmp/systemctl_wrapper/systemctl | ||
|
||
export PATH=/tmp/systemctl_wrapper:$PATH | ||
fi | ||
|
||
./sync_gateway_service_install.sh | ||
./sync_gateway_service_upgrade.sh | ||
./sync_gateway_service_uninstall.sh | ||
|
||
# test again with runas option | ||
./sync_gateway_service_install.sh --runas=root | ||
./sync_gateway_service_upgrade.sh | ||
./sync_gateway_service_uninstall.sh | ||
|
||
echo "Successful service test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters