From cd53dc913443fdd233a5727ed3ea182106e5f1c7 Mon Sep 17 00:00:00 2001 From: Eduardo Barrera Date: Thu, 8 Apr 2021 11:43:10 -0500 Subject: [PATCH 01/12] [BEAM-11608] Add a local setup shell script for Linux and Mac --- local-env-setup.sh | 122 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100755 local-env-setup.sh diff --git a/local-env-setup.sh b/local-env-setup.sh new file mode 100755 index 000000000000..7dc0b9ed3429 --- /dev/null +++ b/local-env-setup.sh @@ -0,0 +1,122 @@ +#!/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. + +darwin_install_pip3_packages() { + echo "Installing virtualenv, grpcio-tools, mypy-protobuf" + pip3 install setuptools virtualenv grpcio-tools mypy-protobuf --user +} + +install_go_packages(){ + echo "Installing goavro" + go get github.com/linkedin/goavro + # As we are using bash, we are assuming .bashrc exists. + grep -qxF "export GOPATH='${pwd}/sdks/go/examples/.gogradle/project_gopath'" ~/.bashrc || echo "export GOPATH='${pwd}/sdks/go/examples/.gogradle/project_gopath'" >> ~/.bashrc + # The following source command will not work if executed in a subshell like $ ./this_script.sh. Instead, we need to run it in the current shell as $ . ./this_script.sh. + # However, this is just to load the GOPATH env variable from the previosu command into the current shell. If that's not required, then we can suggest a terminal reload after the execution? + #source ~/.bashrc +} + +# Running on Linux +if [ "$(uname -s)" = "Linux" ]; then + # Assuming Debian based Linux and the prerequisites in https://beam.apache.org/contribute/ are met: + apt-get update + + echo "Installing openjdk-8-jdk, python-setuptools, python3-pip, virtualenv, tox, docker-ce" + apt-get install -y openjdk-8-jdk python-setuptools python3-pip virtualenv tox docker.io # using python3-pip as Python3 is required. + + type -P python3 > /dev/null 2>&1 + python3Exists=$? + type -P pip3 > /dev/null 2>&1 + pip3Exists=$? + if [ $python3Exists -eq 0 -a $pip3Exists -eq 0 ]; then + echo "Installing grpcio-tools and mypy-protobuf" + pip3 install grpcio-tools mypy-protobuf + else + echo "Python3 and pip3 are required. Installation Failed." + exit + fi + + type -P go > /dev/null 2>&1 + goExists=$? + if [ $goExists -eq 0 ]; then + install_go_packages + else + echo "Go is required. Installation Failed." + exit + fi +fi + +# Running on Mac +if [ "$(uname -s)" = "Darwin" ]; then + # Check for Homebrew, install if we don't have it + type -P brew > /dev/null 2>&1 + brewExists=$? + if [ $brewExists -ne 0 ]; then + echo "Installing homebrew" + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + fi + + # Update homebrew recipes + echo "Updating brew" + brew update + + # Assuming we are using brew + if brew ls --versions openjdk@8 > /dev/null; then + echo "openjdk@8 already installed. Skipping" + else + echo "Installing openjdk@8" + brew install openjdk@8 + fi + + type -P python3 > /dev/null 2>&1 + python3Exists=$? + type -P pip3 > /dev/null 2>&1 + pip3Exists=$? + if [ $python3Exists -eq 0 -a $pip3Exists -eq 0 ]; then + darwin_install_pip3_packages + else + echo "Python3 and pip3 are required. Installation Failed." + exit + fi + + type -P tox > /dev/null 2>&1 + toxExists=$? + if [ $toxExists -eq 0 ]; then + echo "tox already installed. Skipping" + else + echo "Installing tox" + brew install tox + fi + + type -P docker > /dev/null 2>&1 + dockerExists=$? + if [ $dockerExists -eq 0 ]; then + echo "docker already installed. Skipping" + else + echo "Installing docker" + brew install --cask docker + fi + + type -P go > /dev/null 2>&1 + goExists=$? + if [ $goExists -eq 0 ]; then + install_go_packages + else + echo "Go is required. Installation Failed." + exit + fi +fi \ No newline at end of file From b25c3a765c9e8f89de6d003268d11b2c729ae0a3 Mon Sep 17 00:00:00 2001 From: ebarreraWL <77464856+ebarreraWL@users.noreply.github.com> Date: Thu, 15 Apr 2021 12:06:13 -0500 Subject: [PATCH 02/12] [BEAM-11608] Added GitHub workflow for local-env-setup.sh Co-authored-by: Isidro Martinez --- .github/workflows/local_env_tests.yml | 62 +++++++++++++++++++++++++++ build.gradle.kts | 7 +++ examples/java/build.gradle | 9 ++++ local-env-setup.sh | 12 +++--- sdks/go/examples/build.gradle | 7 +++ sdks/python/build.gradle | 12 ++++++ 6 files changed, 104 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/local_env_tests.yml diff --git a/.github/workflows/local_env_tests.yml b/.github/workflows/local_env_tests.yml new file mode 100644 index 000000000000..f5bcb9f27db4 --- /dev/null +++ b/.github/workflows/local_env_tests.yml @@ -0,0 +1,62 @@ +# 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. + +# To learn more about GitHub Actions in Apache Beam check the CI.md + +name: Local environment tests + +on: + schedule: + - cron: '10 2 * * *' + push: + branches: ['master', 'release-*', 'BEAM-1160*'] + tags: 'v*' + pull_request: + branches: ['master', 'release-*'] + tags: 'v*' + paths: ['sdks/python/**', 'model/**'] + workflow_dispatch: + inputs: + runDataflow: + description: 'Type "true" if you want to run Dataflow tests (GCP variables must be configured, check CI.md)' + default: false + +jobs: + run_local_env_install_ubuntu: + timeout-minutes: 25 + name: "Ubuntu run local environment shell script" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: "Installing local env dependencies" + run: "sudo ./local-env-setup.sh" + id: local_env_install_ubuntu + - name: "Gradle check" + run: "./gradlew checkSetup" + id: local_env_install_gradle_check_ubuntu + run_local_env_install_mac: + timeout-minutes: 50 + name: "Mac run local environment shell script" + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - name: "Installing local env dependencies" + run: "./local-env-setup.sh" + id: local_env_install_mac + - name: "Gradle check" + run: "./gradlew --warning-mode all checkSetup --stacktrace" + id: local_env_install_gradle_check_mac \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 2c913a6b36dc..aace3891c0d4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -336,6 +336,13 @@ task("pushAllDockerImages") { } } +// Use this task to validate the environment set up for Go, Python and Java +task("checkSetup") { + dependsOn(":sdks:go:examples:wordCount") + dependsOn(":sdks:python:wordCount") + dependsOn(":examples:java:wordCount") +} + // Configure the release plugin to do only local work; the release manager determines what, if // anything, to push. On failure, the release manager can reset the branch without pushing. release { diff --git a/examples/java/build.gradle b/examples/java/build.gradle index af0d7b80bee9..62f15ec24bc7 100644 --- a/examples/java/build.gradle +++ b/examples/java/build.gradle @@ -161,3 +161,12 @@ task execute (type:JavaExec) { systemProperties System.getProperties() args System.getProperty("exec.args", "").split() } + +// Run this task to validate the Java environment setup for contributors +task wordCount(type:JavaExec) { + description "Run the Java word count example" + main = "org.apache.beam.examples.WordCount" + classpath = sourceSets.main.runtimeClasspath + systemProperties = System.getProperties() + args = ["--output=/tmp/ouput.txt"] +} \ No newline at end of file diff --git a/local-env-setup.sh b/local-env-setup.sh index 7dc0b9ed3429..a6e0fe00bab3 100755 --- a/local-env-setup.sh +++ b/local-env-setup.sh @@ -16,8 +16,10 @@ # limitations under the License. darwin_install_pip3_packages() { - echo "Installing virtualenv, grpcio-tools, mypy-protobuf" - pip3 install setuptools virtualenv grpcio-tools mypy-protobuf --user + echo "Installing setuptools grpcio-tools virtualenv" + pip3 install setuptools grpcio-tools virtualenv + echo "Installing mypy-protobuf" + pip3 install --user mypy-protobuf } install_go_packages(){ @@ -35,8 +37,8 @@ if [ "$(uname -s)" = "Linux" ]; then # Assuming Debian based Linux and the prerequisites in https://beam.apache.org/contribute/ are met: apt-get update - echo "Installing openjdk-8-jdk, python-setuptools, python3-pip, virtualenv, tox, docker-ce" - apt-get install -y openjdk-8-jdk python-setuptools python3-pip virtualenv tox docker.io # using python3-pip as Python3 is required. + echo "Installing openjdk-8-jdk, python-setuptools, python3-pip, tox, docker.io" + apt-get install -y openjdk-8-jdk python-setuptools python3-pip tox docker.io # using python3-pip as Python3 is required. type -P python3 > /dev/null 2>&1 python3Exists=$? @@ -44,7 +46,7 @@ if [ "$(uname -s)" = "Linux" ]; then pip3Exists=$? if [ $python3Exists -eq 0 -a $pip3Exists -eq 0 ]; then echo "Installing grpcio-tools and mypy-protobuf" - pip3 install grpcio-tools mypy-protobuf + pip3 install grpcio-tools mypy-protobuf virtualenv else echo "Python3 and pip3 are required. Installation Failed." exit diff --git a/sdks/go/examples/build.gradle b/sdks/go/examples/build.gradle index 8cf5979dfb1e..c5a4b59d9998 100644 --- a/sdks/go/examples/build.gradle +++ b/sdks/go/examples/build.gradle @@ -77,3 +77,10 @@ golang { continueOnFailure = true } } + +// Run this task to validate the Go environment setup for contributors +task wordCount(type: com.github.blindpirate.gogradle.Go) { + description "Run the Go word count example" + dependsOn goVendor + go 'build -o ./build/bin/${GOOS}_${GOARCH}/wordcount github.com/apache/beam/sdks/go/examples/wordcount' +} \ No newline at end of file diff --git a/sdks/python/build.gradle b/sdks/python/build.gradle index 125a9931f32d..2b7581fb955e 100644 --- a/sdks/python/build.gradle +++ b/sdks/python/build.gradle @@ -110,3 +110,15 @@ task startPortableRunner { } } } + +// Run this task to validate the python environment setup for contributors +task wordCount { + description "Run the Python word count example" + dependsOn 'installGcpTest' + doLast { + exec { + executable 'sh' + args '-c', ". ${envdir}/bin/activate && python -m apache_beam.examples.wordcount --runner DirectRunner --output /tmp/output.txt" + } + } +} \ No newline at end of file From b9b87bdda329e4e3512d1ecd4e2c672b3161a4ab Mon Sep 17 00:00:00 2001 From: Eduardo Barrera Date: Thu, 15 Apr 2021 12:15:54 -0500 Subject: [PATCH 03/12] [BEAM-11608] Added GitHub workflow for local-env-setup.sh (cleaned) --- .github/workflows/local_env_tests.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/local_env_tests.yml b/.github/workflows/local_env_tests.yml index f5bcb9f27db4..8e548b6ad911 100644 --- a/.github/workflows/local_env_tests.yml +++ b/.github/workflows/local_env_tests.yml @@ -20,10 +20,8 @@ name: Local environment tests on: - schedule: - - cron: '10 2 * * *' push: - branches: ['master', 'release-*', 'BEAM-1160*'] + branches: ['master', 'release-*'] tags: 'v*' pull_request: branches: ['master', 'release-*'] @@ -58,5 +56,5 @@ jobs: run: "./local-env-setup.sh" id: local_env_install_mac - name: "Gradle check" - run: "./gradlew --warning-mode all checkSetup --stacktrace" + run: "./gradlew checkSetup" id: local_env_install_gradle_check_mac \ No newline at end of file From 2bfeb429a2ab7bb6fa6575c03a469915458df5f3 Mon Sep 17 00:00:00 2001 From: Eduardo Barrera Date: Fri, 16 Apr 2021 16:05:16 -0500 Subject: [PATCH 04/12] Changed GOPATH behavior. Added extra information on comments. --- local-env-setup.sh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/local-env-setup.sh b/local-env-setup.sh index a6e0fe00bab3..3441c675cdc4 100755 --- a/local-env-setup.sh +++ b/local-env-setup.sh @@ -26,10 +26,8 @@ install_go_packages(){ echo "Installing goavro" go get github.com/linkedin/goavro # As we are using bash, we are assuming .bashrc exists. - grep -qxF "export GOPATH='${pwd}/sdks/go/examples/.gogradle/project_gopath'" ~/.bashrc || echo "export GOPATH='${pwd}/sdks/go/examples/.gogradle/project_gopath'" >> ~/.bashrc - # The following source command will not work if executed in a subshell like $ ./this_script.sh. Instead, we need to run it in the current shell as $ . ./this_script.sh. - # However, this is just to load the GOPATH env variable from the previosu command into the current shell. If that's not required, then we can suggest a terminal reload after the execution? - #source ~/.bashrc + grep -qxF "export GOPATH='${pwd}/sdks/go/examples/.gogradle/project_gopath'" ~/.bashrc || export GOPATH='${pwd}/sdks/go/examples/.gogradle/project_gopath' + echo "GOPATH was set for this session to '$GOPATH'. Make sure to add this path to your ~/.bashrc file after the execution of this script." } # Running on Linux @@ -45,10 +43,10 @@ if [ "$(uname -s)" = "Linux" ]; then type -P pip3 > /dev/null 2>&1 pip3Exists=$? if [ $python3Exists -eq 0 -a $pip3Exists -eq 0 ]; then - echo "Installing grpcio-tools and mypy-protobuf" + echo "Installing grpcio-tools mypy-protobuf and virtualenv" pip3 install grpcio-tools mypy-protobuf virtualenv else - echo "Python3 and pip3 are required. Installation Failed." + echo "Python3 and pip3 are required but failed to install. Install them manually and rerun the script." exit fi @@ -57,7 +55,7 @@ if [ "$(uname -s)" = "Linux" ]; then if [ $goExists -eq 0 ]; then install_go_packages else - echo "Go is required. Installation Failed." + echo "Go is required. Install it manually and rerun the script." exit fi fi @@ -91,7 +89,7 @@ if [ "$(uname -s)" = "Darwin" ]; then if [ $python3Exists -eq 0 -a $pip3Exists -eq 0 ]; then darwin_install_pip3_packages else - echo "Python3 and pip3 are required. Installation Failed." + echo "Python3 and pip3 are required but failed to install. Install them manually and rerun the script." exit fi @@ -118,7 +116,7 @@ if [ "$(uname -s)" = "Darwin" ]; then if [ $goExists -eq 0 ]; then install_go_packages else - echo "Go is required. Installation Failed." + echo "Go is required. Install it manually and rerun the script." exit fi fi \ No newline at end of file From c8b71d5f5cca3a1e40517a50c17f4fcef5953ff6 Mon Sep 17 00:00:00 2001 From: Eduardo Barrera Date: Fri, 16 Apr 2021 17:10:41 -0500 Subject: [PATCH 05/12] Fixed GOPATH check --- local-env-setup.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/local-env-setup.sh b/local-env-setup.sh index 3441c675cdc4..551a43b44fd7 100755 --- a/local-env-setup.sh +++ b/local-env-setup.sh @@ -25,9 +25,12 @@ darwin_install_pip3_packages() { install_go_packages(){ echo "Installing goavro" go get github.com/linkedin/goavro - # As we are using bash, we are assuming .bashrc exists. - grep -qxF "export GOPATH='${pwd}/sdks/go/examples/.gogradle/project_gopath'" ~/.bashrc || export GOPATH='${pwd}/sdks/go/examples/.gogradle/project_gopath' - echo "GOPATH was set for this session to '$GOPATH'. Make sure to add this path to your ~/.bashrc file after the execution of this script." + # As we are using bash, we are assuming .bashrc exists. + grep -qxF "export GOPATH=${PWD}/sdks/go/examples/.gogradle/project_gopath" ~/.bashrc + gopathExists=$? + if [ $gopathExists -ne 0 ]; then + export GOPATH=${PWD}/sdks/go/examples/.gogradle/project_gopath && echo "GOPATH was set for this session to '$GOPATH'. Make sure to add this path to your ~/.bashrc file after the execution of this script." + fi } # Running on Linux From afa2ed3abc647e038576e279d312a67de4eff95d Mon Sep 17 00:00:00 2001 From: Benjamin Gonzalez Date: Tue, 20 Apr 2021 11:01:19 -0500 Subject: [PATCH 06/12] [BEAM-11608] Add link to install docs --- local-env-setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/local-env-setup.sh b/local-env-setup.sh index 551a43b44fd7..d9befe059ebf 100755 --- a/local-env-setup.sh +++ b/local-env-setup.sh @@ -58,7 +58,7 @@ if [ "$(uname -s)" = "Linux" ]; then if [ $goExists -eq 0 ]; then install_go_packages else - echo "Go is required. Install it manually and rerun the script." + echo "Go is required. Install it manually from https://golang.org/doc/install and rerun the script." exit fi fi @@ -119,7 +119,7 @@ if [ "$(uname -s)" = "Darwin" ]; then if [ $goExists -eq 0 ]; then install_go_packages else - echo "Go is required. Install it manually and rerun the script." + echo "Go is required. Install it manually from https://golang.org/doc/install and rerun the script." exit fi fi \ No newline at end of file From 59dad437b811727616bf389bf3281a90502a09d9 Mon Sep 17 00:00:00 2001 From: Fernando Morales Date: Thu, 6 May 2021 15:08:41 -0600 Subject: [PATCH 07/12] [BEAM-11608] Moving dependencies list to external file for outside consumption --- .github/workflows/local_env_tests.yml | 2 +- dev-support/docker/Dockerfile | 32 +++++---------------------- dev-support/docker/pkglist | 25 +++++++++++++++++++++ local-env-setup.sh | 14 ++++++------ sdks/java/extensions/sql/build.gradle | 2 +- 5 files changed, 40 insertions(+), 35 deletions(-) create mode 100644 dev-support/docker/pkglist diff --git a/.github/workflows/local_env_tests.yml b/.github/workflows/local_env_tests.yml index 8e548b6ad911..8e55114a33ac 100644 --- a/.github/workflows/local_env_tests.yml +++ b/.github/workflows/local_env_tests.yml @@ -57,4 +57,4 @@ jobs: id: local_env_install_mac - name: "Gradle check" run: "./gradlew checkSetup" - id: local_env_install_gradle_check_mac \ No newline at end of file + id: local_env_install_gradle_check_mac diff --git a/dev-support/docker/Dockerfile b/dev-support/docker/Dockerfile index 92e5a8cdf845..219a337e0302 100644 --- a/dev-support/docker/Dockerfile +++ b/dev-support/docker/Dockerfile @@ -42,32 +42,12 @@ ENV DEBCONF_TERSE true ### RUN apt -q update \ && apt install -y software-properties-common apt-utils apt-transport-https ca-certificates \ - && add-apt-repository -y ppa:deadsnakes/ppa \ - && apt-get -q install -y --no-install-recommends \ - bash-completion \ - build-essential \ - bzip2 \ - wget \ - curl \ - docker.io \ - g++ \ - gcc \ - git \ - gnupg-agent \ - rsync \ - sudo \ - vim \ - locales \ - wget \ - time \ - openjdk-8-jdk \ - python3-setuptools \ - python3-pip \ - python3.6 \ - python3.7 \ - python3.8 \ - virtualenv \ - tox + && add-apt-repository -y ppa:deadsnakes/ppa + +RUN mkdir /package +COPY pkglist /package/pkglist + +RUN apt-get -q install -y --no-install-recommends $(cat /package/pkglist) ### # Set the locale ( see https://stackoverflow.com/a/28406007/114196 ) diff --git a/dev-support/docker/pkglist b/dev-support/docker/pkglist new file mode 100644 index 000000000000..9fbab31ef261 --- /dev/null +++ b/dev-support/docker/pkglist @@ -0,0 +1,25 @@ +bash-completion +build-essential +bzip2 +wget +curl +docker.io +g++ +gcc +git +gnupg-agent +rsync +sudo +vim +locales +wget +time +openjdk-8-jdk +python3-setuptools +python3-pip +python3.6 +python3.7 +python3.8 +tox +virtualenv +docker.io diff --git a/local-env-setup.sh b/local-env-setup.sh index d9befe059ebf..23cb5c4d99b9 100755 --- a/local-env-setup.sh +++ b/local-env-setup.sh @@ -17,7 +17,7 @@ darwin_install_pip3_packages() { echo "Installing setuptools grpcio-tools virtualenv" - pip3 install setuptools grpcio-tools virtualenv + pip3 install setuptools grpcio-tools echo "Installing mypy-protobuf" pip3 install --user mypy-protobuf } @@ -26,7 +26,7 @@ install_go_packages(){ echo "Installing goavro" go get github.com/linkedin/goavro # As we are using bash, we are assuming .bashrc exists. - grep -qxF "export GOPATH=${PWD}/sdks/go/examples/.gogradle/project_gopath" ~/.bashrc + grep -qxF "export GOPATH=${PWD}/sdks/go/examples/.gogradle/project_gopath" ~/.bashrc gopathExists=$? if [ $gopathExists -ne 0 ]; then export GOPATH=${PWD}/sdks/go/examples/.gogradle/project_gopath && echo "GOPATH was set for this session to '$GOPATH'. Make sure to add this path to your ~/.bashrc file after the execution of this script." @@ -38,16 +38,16 @@ if [ "$(uname -s)" = "Linux" ]; then # Assuming Debian based Linux and the prerequisites in https://beam.apache.org/contribute/ are met: apt-get update - echo "Installing openjdk-8-jdk, python-setuptools, python3-pip, tox, docker.io" - apt-get install -y openjdk-8-jdk python-setuptools python3-pip tox docker.io # using python3-pip as Python3 is required. + echo "Installing dependencies listed in pkglist file" + apt-get install -y $(cat dev-support/docker/pkglist) # pulling dependencies from pkglist file type -P python3 > /dev/null 2>&1 python3Exists=$? type -P pip3 > /dev/null 2>&1 pip3Exists=$? if [ $python3Exists -eq 0 -a $pip3Exists -eq 0 ]; then - echo "Installing grpcio-tools mypy-protobuf and virtualenv" - pip3 install grpcio-tools mypy-protobuf virtualenv + echo "Installing grpcio-tools mypy-protobuf" + pip3 install grpcio-tools mypy-protobuf else echo "Python3 and pip3 are required but failed to install. Install them manually and rerun the script." exit @@ -122,4 +122,4 @@ if [ "$(uname -s)" = "Darwin" ]; then echo "Go is required. Install it manually from https://golang.org/doc/install and rerun the script." exit fi -fi \ No newline at end of file +fi diff --git a/sdks/java/extensions/sql/build.gradle b/sdks/java/extensions/sql/build.gradle index 601b17356187..5d6ee31303ca 100644 --- a/sdks/java/extensions/sql/build.gradle +++ b/sdks/java/extensions/sql/build.gradle @@ -182,7 +182,7 @@ task runPojoExample(type: JavaExec) { } task integrationTest(type: Test) { - def gcpProject = project.findProperty('gcpProject') ?: 'apache-beam-testing' + def gcpProject = project.findProperty('gcpProject') ?: 'wizeline-apache-beam' def gcsTempRoot = project.findProperty('gcsTempRoot') ?: 'gs://temp-storage-for-end-to-end-tests/' // Disable Gradle cache (it should not be used because the IT's won't run). From 8539d0375e221cffe084fc3c232e40e1c91bb491 Mon Sep 17 00:00:00 2001 From: Fernando Morales Date: Thu, 6 May 2021 17:09:28 -0600 Subject: [PATCH 08/12] [BEAM-11608] backtracking change to build.gradle gcpProject variable --- sdks/java/extensions/sql/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdks/java/extensions/sql/build.gradle b/sdks/java/extensions/sql/build.gradle index 5d6ee31303ca..601b17356187 100644 --- a/sdks/java/extensions/sql/build.gradle +++ b/sdks/java/extensions/sql/build.gradle @@ -182,7 +182,7 @@ task runPojoExample(type: JavaExec) { } task integrationTest(type: Test) { - def gcpProject = project.findProperty('gcpProject') ?: 'wizeline-apache-beam' + def gcpProject = project.findProperty('gcpProject') ?: 'apache-beam-testing' def gcsTempRoot = project.findProperty('gcsTempRoot') ?: 'gs://temp-storage-for-end-to-end-tests/' // Disable Gradle cache (it should not be used because the IT's won't run). From 0b57b17c56fce70ffa88325da390926e61f761ef Mon Sep 17 00:00:00 2001 From: Fernando Morales Date: Mon, 10 May 2021 13:12:45 -0600 Subject: [PATCH 09/12] [BEAM-11608] Adding license comment to pkglist file --- dev-support/docker/Dockerfile | 3 +-- dev-support/docker/pkglist | 15 +++++++++++++++ local-env-setup.sh | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/dev-support/docker/Dockerfile b/dev-support/docker/Dockerfile index 219a337e0302..c5b1d7ee0f70 100644 --- a/dev-support/docker/Dockerfile +++ b/dev-support/docker/Dockerfile @@ -46,8 +46,7 @@ RUN apt -q update \ RUN mkdir /package COPY pkglist /package/pkglist - -RUN apt-get -q install -y --no-install-recommends $(cat /package/pkglist) +RUN apt-get -q install -y --no-install-recommends $(grep -v '^#' /package/pkglist | cat) ### # Set the locale ( see https://stackoverflow.com/a/28406007/114196 ) diff --git a/dev-support/docker/pkglist b/dev-support/docker/pkglist index 9fbab31ef261..9620266351e8 100644 --- a/dev-support/docker/pkglist +++ b/dev-support/docker/pkglist @@ -1,3 +1,18 @@ +# 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. + bash-completion build-essential bzip2 diff --git a/local-env-setup.sh b/local-env-setup.sh index 23cb5c4d99b9..731532e85734 100755 --- a/local-env-setup.sh +++ b/local-env-setup.sh @@ -39,7 +39,7 @@ if [ "$(uname -s)" = "Linux" ]; then apt-get update echo "Installing dependencies listed in pkglist file" - apt-get install -y $(cat dev-support/docker/pkglist) # pulling dependencies from pkglist file + apt-get install -y $(grep -v '^#' dev-support/docker/pkglist | cat) # pulling dependencies from pkglist file type -P python3 > /dev/null 2>&1 python3Exists=$? From ab8952b88a993c318385c757d87163d70f9a78cf Mon Sep 17 00:00:00 2001 From: Fernando Morales Date: Mon, 24 May 2021 10:02:21 -0600 Subject: [PATCH 10/12] [BEAM-11608] Adding changes suggested in code review --- .github/workflows/local_env_tests.yml | 7 +------ local-env-setup.sh | 9 ++++++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/local_env_tests.yml b/.github/workflows/local_env_tests.yml index 8e55114a33ac..2bf6af1c6a88 100644 --- a/.github/workflows/local_env_tests.yml +++ b/.github/workflows/local_env_tests.yml @@ -26,12 +26,7 @@ on: pull_request: branches: ['master', 'release-*'] tags: 'v*' - paths: ['sdks/python/**', 'model/**'] - workflow_dispatch: - inputs: - runDataflow: - description: 'Type "true" if you want to run Dataflow tests (GCP variables must be configured, check CI.md)' - default: false + paths: ['dev-support/**', 'buildSrc/**', '**/build.gradle', 'sdks/python/setup.py', 'sdks/python/tox.ini'] jobs: run_local_env_install_ubuntu: diff --git a/local-env-setup.sh b/local-env-setup.sh index 731532e85734..f8de9a2d7000 100755 --- a/local-env-setup.sh +++ b/local-env-setup.sh @@ -33,8 +33,10 @@ install_go_packages(){ fi } +kernelname=$(uname -s) + # Running on Linux -if [ "$(uname -s)" = "Linux" ]; then +if [ "$kernelname" = "Linux" ]; then # Assuming Debian based Linux and the prerequisites in https://beam.apache.org/contribute/ are met: apt-get update @@ -61,10 +63,9 @@ if [ "$(uname -s)" = "Linux" ]; then echo "Go is required. Install it manually from https://golang.org/doc/install and rerun the script." exit fi -fi # Running on Mac -if [ "$(uname -s)" = "Darwin" ]; then +elif [ "$kernelname" = "Darwin" ]; then # Check for Homebrew, install if we don't have it type -P brew > /dev/null 2>&1 brewExists=$? @@ -122,4 +123,6 @@ if [ "$(uname -s)" = "Darwin" ]; then echo "Go is required. Install it manually from https://golang.org/doc/install and rerun the script." exit fi + +else echo "Unrecognized Kernel Name: $kernelname" fi From dc7c95373c8fd28ca233efa66b79d0668e622821 Mon Sep 17 00:00:00 2001 From: Fernando Morales Date: Fri, 28 May 2021 11:12:39 -0600 Subject: [PATCH 11/12] [BEAM-11608] Installing virtualenv using pip3 --- dev-support/docker/pkglist | 1 - local-env-setup.sh | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dev-support/docker/pkglist b/dev-support/docker/pkglist index 9620266351e8..00fc31684725 100644 --- a/dev-support/docker/pkglist +++ b/dev-support/docker/pkglist @@ -36,5 +36,4 @@ python3.6 python3.7 python3.8 tox -virtualenv docker.io diff --git a/local-env-setup.sh b/local-env-setup.sh index f8de9a2d7000..c52d15b4e741 100755 --- a/local-env-setup.sh +++ b/local-env-setup.sh @@ -17,7 +17,7 @@ darwin_install_pip3_packages() { echo "Installing setuptools grpcio-tools virtualenv" - pip3 install setuptools grpcio-tools + pip3 install setuptools grpcio-tools virtualenv echo "Installing mypy-protobuf" pip3 install --user mypy-protobuf } @@ -48,8 +48,8 @@ if [ "$kernelname" = "Linux" ]; then type -P pip3 > /dev/null 2>&1 pip3Exists=$? if [ $python3Exists -eq 0 -a $pip3Exists -eq 0 ]; then - echo "Installing grpcio-tools mypy-protobuf" - pip3 install grpcio-tools mypy-protobuf + echo "Installing grpcio-tools mypy-protobuf virtualenv" + pip3 install grpcio-tools mypy-protobuf virtualenv else echo "Python3 and pip3 are required but failed to install. Install them manually and rerun the script." exit From 25da8ad6a217eb982cd99f229ea75d979489cf66 Mon Sep 17 00:00:00 2001 From: Fernando Morales Date: Fri, 28 May 2021 18:15:00 -0600 Subject: [PATCH 12/12] [BEAM-11608] Adding virtualenv dependency to Dockerfile --- dev-support/docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-support/docker/Dockerfile b/dev-support/docker/Dockerfile index c5b1d7ee0f70..ff9bb2ab52ea 100644 --- a/dev-support/docker/Dockerfile +++ b/dev-support/docker/Dockerfile @@ -66,7 +66,7 @@ RUN alias python=python3.6 ### # Install grpcio-tools mypy-protobuf for `python3 sdks/python/setup.py sdist` to work ### -RUN pip3 install grpcio-tools mypy-protobuf +RUN pip3 install grpcio-tools mypy-protobuf virtualenv ### # Install useful tools