Mmuzaf commented on code in PR #2971:
URL: https://github.com/apache/cassandra/pull/2971#discussion_r1425220462
##########
.build/build-owasp.xml:
##########
@@ -52,35 +72,125 @@
</taskdef>
<!--
- default value for cveValidForHours is 4 after which sync is done
again
-
- skipping using two specific caches at the end is solving (1)
+ default value for nvdValidForHours is 4 after which sync is done
again
failBuildOnCVSS is by default 11 so build would never fail,
- the table categorising vulnerabilities is here (2), so by setting
+ the table categorising vulnerabilities is here (1), so by setting
"failBuildOnCVSS" to 1, we will fail the build on any CVE found
if it is not suppressed already dependency-check-suppressions.xml
If a vendor provides no details about a vulnerability,
NVD will score that vulnerability as 10.0 (the highest rating
translating to critical).
- (1) https://github.com/jeremylong/DependencyCheck/issues/2166
- (2) https://nvd.nist.gov/vuln-metrics/cvss
+ (1) https://nvd.nist.gov/vuln-metrics/cvss
-->
<dependency-check projectname="Apache Cassandra"
- reportoutputdirectory="${basedir}/build"
- reportformat="HTML"
+ nvdApiKey="${nvd.api.key}"
+
reportoutputdirectory="${dependency-check.report.dir}"
+ reportformat="ALL"
prettyPrint="true"
- cveValidForHours="1"
- centralAnalyzerUseCache="false"
- nodeAuditAnalyzerUseCache="false"
+ nvdValidForHours="${nvd.validity.hours}"
+ centralAnalyzerUseCache="true"
+ nodeAuditAnalyzerUseCache="true"
failBuildOnCVSS="1"
assemblyAnalyzerEnabled="false"
- dataDirectory="${dependency-check.home}/data"
+ dataDirectory="${nvd.data.dir}"
suppressionFile="${basedir}/.build/dependency-check-suppressions.xml">
- <fileset dir="lib">
- <include name="**/*.jar"/>
- </fileset>
+ <fileset refid="dependencies_to_check"/>
</dependency-check>
</target>
+
+ <target name="-resolve-latest-nightly-build" unless="nightly.build.dir">
+ <property name="nightly.version" value="3.0"/>
+ <property name="nightlies.url"
+
value="https://nightlies.apache.org/cassandra/cassandra-${nightly.version}/Cassandra-${nightly.version}-artifacts"/>
+ <exec executable="curl" failonerror="true" failifexecutionfails="true"
logerror="true">
+ <arg value="-s"/>
+ <arg value="${nightlies.url}/?C=M;O=D"/>
+ <redirector outputproperty="last.build.number">
+ <outputfilterchain>
+ <linecontainsregexp regexp="href="([0-9]+./)""/>
+ <replaceregex byline="true"
pattern=".*href="([0-9]+)/".*" replace="\1"/>
+ <headfilter lines="1"/>
+ </outputfilterchain>
+ </redirector>
+ </exec>
+ <echo message="last.build.number=${last.build.number}"/>
+
+ <property name="last.build.url"
+
value="${nightlies.url}/${last.build.number}/Cassandra-${nightly.version}-artifacts/jdk=jdk_1.8_latest,label=cassandra/build"/>
+ <exec executable="curl" failonerror="true" failifexecutionfails="true"
logerror="true">
+ <arg value="-s"/>
+ <arg value="${last.build.url}/"/>
+ <redirector outputproperty="last.build.name">
+ <outputfilterchain>
+ <linecontainsregexp regexp="-bin\.tar\.gz"/>
+ <replaceregex byline="true"
pattern=".*href="([^"]+)".*" replace="\1"/>
+ <headfilter lines="1"/>
+ </outputfilterchain>
+ </redirector>
+ </exec>
+ <property name="last.build.artifact.url"
value="${last.build.url}/${last.build.name}"/>
+ <echo message="last.build.artifact.url=${last.build.artifact.url}"/>
+ </target>
+
+ <target name="-maybe-fetch-latest-nightly-build"
depends="-resolve-latest-nightly-build" unless="nightly.build.dir">
+ <property name="cassandra.nightlies.dir"
value="${tmp.dir}/cassandra-nightlies"/>
+ <property name="nightly.build.dir"
value="${cassandra.nightlies.dir}/${nightly.version}/${last.build.number}"/>
+ <condition property="nightly.build.dir.exists">
+ <available file="${nightly.build.dir}" type="dir"/>
+ </condition>
+ <antcall target="-fetch-latest-nightly-build"
unless:set="nightly.build.dir.exists" inheritall="true"
+ inheritrefs="true"/>
+ </target>
+
+ <target name="-fetch-latest-nightly-build">
+ <dirname property="nightly.build.parent.dir"
file="${nightly.build.dir}"/>
+ <delete dir="${nightly.build.parent.dir}" includeemptydirs="true"
failonerror="false"/>
+ <mkdir dir="${nightly.build.dir}"/>
+ <get src="${last.build.artifact.url}"
dest="${nightly.build.dir}/cassandra.tar.gz" verbose="true"/>
+ <gunzip src="${nightly.build.dir}/cassandra.tar.gz"
dest="${nightly.build.dir}/cassandra.tar"/>
+ <delete file="${nightly.build.dir}/cassandra.tar.gz"/>
+ <untar src="${nightly.build.dir}/cassandra.tar"
dest="${nightly.build.dir}/" allowfilestoescapedest="false"
+ stripabsolutepathspec="2"/>
+ <delete file="${nightly.build.dir}/cassandra.tar"/>
+ <exec executable="bash" failifexecutionfails="true" failonerror="true"
logerror="true"
+ dir="${nightly.build.dir}">
+ <arg value="-c"/>
+ <arg value="mv apache-cassandra-*/* .; rm -rf apache-cassandra-*"/>
+ </exec>
+ </target>
+
+ <target name="-determine-dependency-changes">
+ <get
src="https://raw.githubusercontent.com/apache/cassandra/cassandra-3.0/build.xml"
retries="3"
Review Comment:
The branch is hardcoded, is it correct? Should we determine the branch based
on the git command output results?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]