Skip to content

Commit

Permalink
[FLINK-19810][CI] Automatically run a basic NOTICE file check on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
rmetzger committed Nov 4, 2020
1 parent 7a2d76d commit 2d50a44
Show file tree
Hide file tree
Showing 10 changed files with 549 additions and 4 deletions.
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ under the License.
<module>flink-walkthroughs</module>
<module>flink-kubernetes</module>
<module>flink-external-resources</module>
<module>tools/ci/java-ci-tools</module>
</modules>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion tools/azure-pipelines/jobs-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ jobs:
IT_CASE_S3_BUCKET: $(SECRET_S3_BUCKET)
IT_CASE_S3_ACCESS_KEY: $(SECRET_S3_ACCESS_KEY)
IT_CASE_S3_SECRET_KEY: $(SECRET_S3_SECRET_KEY)
condition: not(eq(variables['SKIP'], '1'))
condition: and(succeeded(),not(eq(variables['SKIP'], '1')))
# upload debug artifacts
- task: PublishPipelineArtifact@1
condition: and(succeededOrFailed(), not(eq(variables['SKIP'], '1')), not(eq(variables['ARTIFACT_DIR'], '')))
Expand Down
17 changes: 15 additions & 2 deletions tools/ci/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ if [ -z "$HERE" ] ; then
exit 1 # fail
fi
CI_DIR="$HERE/../ci"
MVN_CLEAN_COMPILE_OUT="/tmp/clean_compile.out"

# source required ci scripts
source "${CI_DIR}/stage.sh"
Expand All @@ -43,14 +44,22 @@ echo "==========================================================================
EXIT_CODE=0

run_mvn clean install $MAVEN_OPTS -Dflink.convergence.phase=install -Pcheck-convergence -Dflink.forkCount=2 \
-Dflink.forkCountTestPackage=2 -Dmaven.javadoc.skip=true -U -DskipTests
-Dflink.forkCountTestPackage=2 -Dmaven.javadoc.skip=true -U -DskipTests | tee $MVN_CLEAN_COMPILE_OUT

EXIT_CODE=$?
EXIT_CODE=${PIPESTATUS[0]}

if [ $EXIT_CODE != 0 ]; then
echo "=============================================================================="
echo "Compiling Flink failed."
echo "=============================================================================="

grep "0 Unknown Licenses" target/rat.txt > /dev/null

if [ $? != 0 ]; then
echo "License header check failure detected. Printing first 50 lines for convenience:"
head -n 50 target/rat.txt
fi

exit $EXIT_CODE
fi

Expand Down Expand Up @@ -96,5 +105,9 @@ EXIT_CODE=$(($EXIT_CODE+$?))
check_shaded_artifacts_connector_elasticsearch 6
EXIT_CODE=$(($EXIT_CODE+$?))

echo "============ Run license check ============"

${CI_DIR}/license_check.sh $MVN_CLEAN_COMPILE_OUT $CI_DIR $(pwd) || exit $?

exit $EXIT_CODE

71 changes: 71 additions & 0 deletions tools/ci/java-ci-tools/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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:https://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.
-->
<project xmlns="http:https://maven.apache.org/POM/4.0.0" xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http:https://maven.apache.org/POM/4.0.0 http:https://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.flink</groupId>
<artifactId>flink-parent</artifactId>
<version>1.12-SNAPSHOT</version>
<relativePath>../../..</relativePath>
</parent>

<artifactId>java-ci-tools</artifactId>
<version>1.12-SNAPSHOT</version>
<name>Flink : Tools : CI : Java</name>

<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.0-jre</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>

</project>
Loading

0 comments on commit 2d50a44

Please sign in to comment.