Skip to content

Commit

Permalink
[FLINK-13978][build system] Add experimental support for building on …
Browse files Browse the repository at this point in the history
…Azure Pipelines
  • Loading branch information
rmetzger committed Feb 16, 2020
1 parent a95eb5e commit 7c444b5
Show file tree
Hide file tree
Showing 12 changed files with 564 additions and 92 deletions.
48 changes: 36 additions & 12 deletions azure-pipelines.yml
Expand Up @@ -13,23 +13,47 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#
# This file defines an Azure Pipeline build for testing Flink. It is intended to be used
# with a free Azure Pipelines account.
# It has the following features:
# - default builds for pushes / pull requests
# - end-to-end tests
#
#
# For the "apache/flink" repository, we are using the pipeline definition located in
# tools/azure-pipelines/build-apache-repo.yml
# That file points to custom, self-hosted build agents for faster pull request build processing and
# integration with Flinkbot.
# The custom pipeline definition file is configured in the "Pipeline settings" screen
# of the Azure Pipelines web ui.
#

trigger:
branches:
include:
- '*'

resources:
containers:
# Container with Maven 3.2.5 to have the same environment everywhere.
# Container with Maven 3.2.5, SSL to have the same environment everywhere.
- container: flink-build-container
image: rmetzger/flink-ci:3
repositories:
- repository: templates
type: github
name: flink-ci/flink-azure-builds
endpoint: flink-ci
image: rmetzger/flink-ci:ubuntu-jdk8-amd64-2a765ab

# See tools/azure-pipelines/jobs-template.yml for a short summary of the caching
variables:
MAVEN_CACHE_FOLDER: $(Pipeline.Workspace)/.m2/repository
MAVEN_OPTS: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'
CACHE_KEY: maven | $(Agent.OS) | **/pom.xml, !**/target/**
CACHE_FALLBACK_KEY: maven | $(Agent.OS)
CACHE_FLINK_DIR: $(Pipeline.Workspace)/flink_cache


jobs:
- template: flink-build-jobs.yml@templates
- template: tools/azure-pipelines/jobs-template.yml
parameters: # see template file for a definition of the parameters.
stage_name: ci_build
test_pool_definition:
vmImage: 'ubuntu-latest'
e2e_pool_definition:
vmImage: 'ubuntu-16.04'
environment: PROFILE="-Dhadoop.version=2.8.3 -Dinclude_hadoop_aws -Dscala-2.11"



7 changes: 5 additions & 2 deletions flink-end-to-end-tests/run-nightly-tests.sh
Expand Up @@ -88,8 +88,11 @@ run_test "Resuming Externalized Checkpoint after terminal failure (rocks, increm
# Docker
################################################################################

run_test "Running Kerberized YARN on Docker test (default input)" "$END_TO_END_DIR/test-scripts/test_yarn_kerberos_docker.sh"
run_test "Running Kerberized YARN on Docker test (custom fs plugin)" "$END_TO_END_DIR/test-scripts/test_yarn_kerberos_docker.sh dummy-fs"
# Ignore these tests on Azure: In these tests, the TaskManagers are not starting on YARN, probably due to memory constraints.
if [ -z "$TF_BUILD" ] ; then
run_test "Running Kerberized YARN on Docker test (default input)" "$END_TO_END_DIR/test-scripts/test_yarn_kerberos_docker.sh"
run_test "Running Kerberized YARN on Docker test (custom fs plugin)" "$END_TO_END_DIR/test-scripts/test_yarn_kerberos_docker.sh dummy-fs"
fi

################################################################################
# High Availability
Expand Down
47 changes: 5 additions & 42 deletions flink-end-to-end-tests/test-scripts/common.sh
Expand Up @@ -247,9 +247,7 @@ function wait_rest_endpoint_up {
echo "Waiting for ${endpoint_name} REST endpoint to come up..."
sleep 1
done
echo "${endpoint_name} REST endpoint has not started on query url '${query_url}' within a timeout of ${TIMEOUT} sec. curl output:"
curl ${CURL_SSL_ARGS} "$query_url"
echo "Exiting ..."
echo "${endpoint_name} REST endpoint has not started within a timeout of ${TIMEOUT} sec"
exit 1
}

Expand Down Expand Up @@ -439,51 +437,16 @@ function wait_for_job_state_transition {
done
}

function is_job_submitted {
JOB_LIST_RESULT=$("$FLINK_DIR"/bin/flink list -a | grep "$1")
if [[ "$JOB_LIST_RESULT" == "" ]]; then
echo "false"
else
echo "true"
fi
}

function wait_job_submitted {
local TIMEOUT=10
for i in $(seq 1 ${TIMEOUT}); do
local IS_SUBMITTED=`is_job_submitted $1`

if [[ "$IS_SUBMITTED" == "true" ]]; then
echo "Job ($1) is submitted."
return
else
echo "Job ($1) is not yet submitted."
fi
sleep 1
done
echo "Job ($1) has not been submitted within a timeout of ${TIMEOUT} sec"
exit 1
}

function is_job_running {
JOB_LIST_RESULT=$("$FLINK_DIR"/bin/flink list -r | grep "$1")
if [[ "$JOB_LIST_RESULT" == "" ]]; then
echo "false"
else
echo "true"
fi
}

function wait_job_running {
local TIMEOUT=10
for i in $(seq 1 ${TIMEOUT}); do
local IS_RUNNING=`is_job_running $1`
JOB_LIST_RESULT=$("$FLINK_DIR"/bin/flink list -r | grep "$1")

if [[ "$IS_RUNNING" == "true" ]]; then
if [[ "$JOB_LIST_RESULT" == "" ]]; then
echo "Job ($1) is not yet running."
else
echo "Job ($1) is running."
return
else
echo "Job ($1) is not yet running."
fi
sleep 1
done
Expand Down
2 changes: 1 addition & 1 deletion flink-end-to-end-tests/test-scripts/test-runner-common.sh
Expand Up @@ -19,7 +19,7 @@

source "${END_TO_END_DIR}"/test-scripts/common.sh

FLINK_VERSION=$(mvn --file ${END_TO_END_DIR}/pom.xml org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout)
export FLINK_VERSION=$(mvn --file ${END_TO_END_DIR}/pom.xml org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout)

#######################################
# Prints the given description, runs the given test and prints how long the execution took.
Expand Down
Expand Up @@ -39,31 +39,10 @@ on_exit test_cleanup
TEST_ES_JAR=${END_TO_END_DIR}/flink-elasticsearch${ELASTICSEARCH_VERSION}-test/target/Elasticsearch${ELASTICSEARCH_VERSION}SinkExample.jar

# run the Flink job
JOB_ID=$($FLINK_DIR/bin/flink run -d -p 1 $TEST_ES_JAR \
$FLINK_DIR/bin/flink run -p 1 $TEST_ES_JAR \
--numRecords 20 \
--index index \
--type type | awk '{print $NF}' | tail -n 1)
--type type


# wait for 10 seconds
wait_job_submitted ${JOB_ID}

# Wait for 60 seconds for the job to finish
MAX_RETRY_SECONDS=60

start_time=$(date +%s)

RUNNING=`is_job_running ${JOB_ID}`
while [[ "$RUNNING" == "true" ]]; do
RUNNING=`is_job_running ${JOB_ID}`
current_time=$(date +%s)
time_diff=$((current_time - start_time))
if [ $time_diff -ge $MAX_RETRY_SECONDS ]; then
echo "Job did not finish after $MAX_RETRY_SECONDS seconds. Printing logs and failing test: "
cat $FLINK_DIR/log/*
exit 1
fi
done

# 40 index requests and 20 final update requests
verify_result_line_number 60 index
50 changes: 50 additions & 0 deletions tools/azure-pipelines/build-apache-repo.yml
@@ -0,0 +1,50 @@
# 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.


#
# This file defines the Flink build for the "apache/flink" repository, including
# the following:
# - PR builds
# - custom triggered e2e tests
# - nightly builds

resources:
containers:
# Container with Maven 3.2.5, SSL to have the same environment everywhere.
- container: flink-build-container
image: rmetzger/flink-ci:ubuntu-jdk8-amd64-2a765ab

variables:
MAVEN_CACHE_FOLDER: $(Pipeline.Workspace)/.m2/repository
MAVEN_OPTS: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'
CACHE_KEY: maven | $(Agent.OS) | **/pom.xml, !**/target/**
CACHE_FALLBACK_KEY: maven | $(Agent.OS)
CACHE_FLINK_DIR: $(Pipeline.Workspace)/flink_cache

stages:
# CI / PR triggered stage:
- stage: ci_build
displayName: "CI Build (custom builders)"
condition: not(eq(variables['Build.Reason'], in('Schedule', 'Manual')))
jobs:
- template: jobs-template.yml
parameters:
stage_name: ci_build
test_pool_definition:
name: Default
e2e_pool_definition:
vmImage: 'ubuntu-16.04'
environment: PROFILE="-Dhadoop.version=2.8.3 -Dinclude_hadoop_aws -Dscala-2.11"
28 changes: 28 additions & 0 deletions tools/azure-pipelines/google-mirror-settings.xml
@@ -0,0 +1,28 @@
<!--
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.
-->
<settings>
<mirrors>
<mirror>
<id>google-maven-central</id>
<name>GCS Maven Central mirror</name>
<url>https://maven-central-eu.storage-download.googleapis.com/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>

0 comments on commit 7c444b5

Please sign in to comment.