From da5f55e34bb92802373c9283ee6fc7de4af66f6e Mon Sep 17 00:00:00 2001 From: cruizba Date: Sat, 14 Oct 2023 21:29:32 +0200 Subject: [PATCH] openvidu-ci: Enable snapshots only if snapshot version is used --- .github/workflows/openvidu-ce-test.yml | 2 ++ ci-scripts/commons/test-utils.sh | 37 ++++++++++++++++++-------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/.github/workflows/openvidu-ce-test.yml b/.github/workflows/openvidu-ce-test.yml index 7496028d..5c623b0c 100644 --- a/.github/workflows/openvidu-ce-test.yml +++ b/.github/workflows/openvidu-ce-test.yml @@ -70,6 +70,8 @@ jobs: run: /opt/build.sh --clean-environment - name: Prepare test environment run: /opt/test-utils.sh --prepare-test-environment "${TEST_IMAGE}" + - name: Check and prepare kurento snapshots + run: /opt/test-utils.sh --check-and-prepare-kurento-snapshot - name: Use specific kurento-java commit if: ${{ env.KURENTO_JAVA_COMMIT != 'default'}} run: /opt/test-utils.sh --use-specific-kurento-java-commit diff --git a/ci-scripts/commons/test-utils.sh b/ci-scripts/commons/test-utils.sh index 0d3d8973..f370ccf0 100644 --- a/ci-scripts/commons/test-utils.sh +++ b/ci-scripts/commons/test-utils.sh @@ -10,6 +10,7 @@ set -eu -o pipefail PREPARE_TEST_ENVIRONMENT=false USE_SPECIFIC_KURENTO_JAVA_COMMIT=false SERVE_OV_TESTAPP=false +CHECK_AND_PREPARE_KURENTO_SNAPSHOT=false if [[ -n ${1:-} ]]; then case "${1:-}" in @@ -18,6 +19,10 @@ if [[ -n ${1:-} ]]; then PREPARE_TEST_ENVIRONMENT=true ;; + --check-and-prepare-kurento-snapshot) + CHECK_AND_PREPARE_KURENTO_SNAPSHOT=true + ;; + --use-specific-kurento-java-commit) USE_SPECIFIC_KURENTO_JAVA_COMMIT=true ;; @@ -59,17 +64,6 @@ if [[ "${PREPARE_TEST_ENVIRONMENT}" == true ]]; then # Prepare directory for OpenVidu Android apps sudo mkdir -p /opt/openvidu/android && sudo chmod 777 /opt/openvidu/android - # Configure Snapshots repository - if [[ -n "${KURENTO_SNAPSHOTS_URL:-}" ]]; then - sudo mkdir -p /etc/maven - sudo chmod -R 777 /etc/maven - pushd /etc/maven - rm -f settings.xml - curl https://raw.githubusercontent.com/OpenVidu/openvidu/master/ci-scripts/kurento-snapshots.xml -o settings.xml - sed -i "s|KURENTO_SNAPSHOTS_URL|${KURENTO_SNAPSHOTS_URL}|g" settings.xml - popd - fi - # Download fake videos FAKE_VIDEO1=/opt/openvidu/barcode.y4m FAKE_VIDEO2=/opt/openvidu/girl.mjpeg @@ -132,6 +126,27 @@ if [[ "${PREPARE_TEST_ENVIRONMENT}" == true ]]; then fi +# ------------- +# Check kurento version from pom.xml +# If kurento version is a snapshot, configure snapshot builds +# ------------- +if [[ "${CHECK_AND_PREPARE_KURENTO_SNAPSHOT}" == true ]]; then + # Check if kurento version is a snapshot + KURENTO_VERSION=$(awk -F'[<>]' '// {print $3}' pom.xml) + if [[ "${KURENTO_VERSION}" == *"-SNAPSHOT" ]] && [[ -n "${KURENTO_SNAPSHOTS_URL:-}" ]]; then + echo "Kurento version is a SNAPSHOT: ${KURENTO_VERSION}" + sudo mkdir -p /etc/maven + sudo chmod -R 777 /etc/maven + pushd /etc/maven + rm -f settings.xml + curl https://raw.githubusercontent.com/OpenVidu/openvidu/master/ci-scripts/kurento-snapshots.xml -o settings.xml + sed -i "s|KURENTO_SNAPSHOTS_URL|${KURENTO_SNAPSHOTS_URL}|g" settings.xml + popd + else + echo "Kurento version is not a SNAPSHOT: ${KURENTO_VERSION}" + fi +fi + # ------------- # Use a specific kurento-java commit other than the configured in openvidu-parent pom.xml # -------------