olehborysevych commented on code in PR #24614: URL: https://github.com/apache/beam/pull/24614#discussion_r1049827502
########## playground/infrastructure/cloudbuild/playground_examples_ci.sh: ########## @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +export GRADLE_VERSION=7.5.1 +export GO_VERSION=1.18 + +#Install python java8 and dependencies +apt-get update > /dev/null +export DEBIAN_FRONTEND=noninteractive +apt-get install -y apt-transport-https ca-certificates software-properties-common curl unzip apt-utils > /dev/null +add-apt-repository -y ppa:deadsnakes/ppa > /dev/null && apt update > /dev/null +apt install -y python3.8 python3.8-distutils python3-pip > /dev/null +apt install --reinstall python3.8-distutils > /dev/null +pip install --upgrade google-api-python-client > /dev/null +python3.8 -m pip install pip --upgrade > /dev/null +ln -s /usr/bin/python3.8 /usr/bin/python > /dev/null +apt install python3.8-venv > /dev/null +pip install -r playground/infrastructure/requirements.txt > /dev/null + +# Install jdk and gradle +apt-get install openjdk-8-jdk -y > /dev/null +curl -L https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip -o gradle-${GRADLE_VERSION}-bin.zip > /dev/null +unzip gradle-${GRADLE_VERSION}-bin.zip > /dev/null +export PATH=$PATH:gradle-${GRADLE_VERSION}/bin + +# Install go +curl -OL https://golang.org/dl/go$GO_VERSION.linux-amd64.tar.gz > /dev/null +tar -C /usr/local -xvf go$GO_VERSION.linux-amd64.tar.gz > /dev/null +export PATH=$PATH:/usr/local/go/bin + +# Install Docker +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - +add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable" > /dev/null +apt update > /dev/null && apt install -y docker-ce > /dev/null + +export \ +ORIGIN=PG_EXAMPLES \ +STEP=CI \ +SUBDIRS="./learning/katas ./examples ./sdks" \ +GOOGLE_CLOUD_PROJECT=$PROJECT_ID \ +BEAM_ROOT_DIR="." \ +SDK_CONFIG="playground/sdks.yaml" \ +BEAM_EXAMPLE_CATEGORIES="playground/categories.yaml" \ +BEAM_CONCURRENCY=4 \ +BEAM_VERSION=2.43.0 \ +sdks=("java" "python" "go") \ +allowlist=("playground/infrastructure" "playground/backend") + +# Get Difference +# branch name will be master for any branch in cloud build +# Example: even if branch name in cloud build trigger is some "feature" +# it will appear as master in builder log +base_ref=refs/heads/master +if [ -z "$base_ref" ] || [ "$base_ref" == "refs/heads/master" ] +then + base_ref=refs/heads/master +fi +diff=$(git diff --name-only $base_ref | tr '\n' ' ') + +# Check if there are Examples +for sdk in "${sdks[@]}" +do + python3 playground/infrastructure/checker.py \ + --verbose \ + --sdk SDK_"${sdk^^}" \ + --allowlist "${allowlist}" \ + --paths "${diff}" +if [ $? -eq 0 ] + then + example_has_changed=True + else + example_has_changed=False Review Comment: I would still make on outer loop checking if examples have changed for a particular sdk and do a verification in a single interation. This could save us a lot of time and resources. Otherwise we are checking examples for all sdk's even if examples have changed for one of them. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
