Skip to content

Commit 0231191

Browse files
authored
HADOOP-16748. Migrate to Python 3 and upgrade Yetus to 0.13.0 (#3832)
- Upgrade Yetus to 0.13.0 to support Python 3 for the release scripts. - Removed determine-flaky-tests-hadoop.py. - Temporarily disabled shelldocs check due to YETUS-1099. Reviewed-by: Inigo Goiri <inigoiri@apache.org> Reviewed-by: Mingliang Liu <liuml07@apache.org> (cherry picked from commit b9b49ed) Conflicts: dev-support/Jenkinsfile dev-support/bin/yetus-wrapper dev-support/docker/Dockerfile dev-support/docker/Dockerfile_aarch64
1 parent 87726b3 commit 0231191

File tree

5 files changed

+33
-299
lines changed

5 files changed

+33
-299
lines changed

dev-support/Jenkinsfile

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pipeline {
3535
DOCKERFILE = "${SOURCEDIR}/dev-support/docker/Dockerfile"
3636
YETUS='yetus'
3737
// Branch or tag name. Yetus release tags are 'rel/X.Y.Z'
38-
YETUS_VERSION='rel/0.12.0'
38+
YETUS_VERSION='rel/0.13.0'
3939
MAVEN_OPTS='-Xms256m -Xmx1536m -Dhttps.protocols=TLSv1.2 -Dhttps.cipherSuites=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'
4040
}
4141

@@ -61,7 +61,7 @@ pipeline {
6161
stage ('precommit-run') {
6262
steps {
6363
withCredentials(
64-
[usernamePassword(credentialsId: 'apache-hadoop-at-github.com',
64+
[usernamePassword(credentialsId: '683f5dcf-5552-4b28-9fb1-6a6b77cf53dd',
6565
passwordVariable: 'GITHUB_TOKEN',
6666
usernameVariable: 'GITHUB_USER')]) {
6767
sh '''#!/usr/bin/env bash
@@ -127,9 +127,6 @@ pipeline {
127127
# plugins to enable
128128
YETUS_ARGS+=("--plugins=all,-jira")
129129
130-
# use Hadoop's bundled shelldocs
131-
YETUS_ARGS+=("--shelldocs=${WORKSPACE}/${SOURCEDIR}/dev-support/bin/shelldocs")
132-
133130
# don't let these tests cause -1s because we aren't really paying that
134131
# much attention to them
135132
YETUS_ARGS+=("--tests-filter=checkstyle")
@@ -146,9 +143,6 @@ pipeline {
146143
# help keep the ASF boxes clean
147144
YETUS_ARGS+=("--sentinel")
148145
149-
# use emoji vote so it is easier to find the broken line
150-
YETUS_ARGS+=("--github-use-emoji-vote")
151-
152146
# Use both Java 7 and 8
153147
YETUS_ARGS+=("--java-home=/usr/lib/jvm/java-8-openjdk-amd64")
154148
YETUS_ARGS+=("--multijdkdirs=/usr/lib/jvm/zulu-7-amd64")
@@ -165,6 +159,19 @@ pipeline {
165159
post {
166160
always {
167161
script {
162+
// Publish status if it was missed (YETUS-1059)
163+
withCredentials(
164+
[usernamePassword(credentialsId: '683f5dcf-5552-4b28-9fb1-6a6b77cf53dd',
165+
passwordVariable: 'GITHUB_TOKEN',
166+
usernameVariable: 'GITHUB_USER')]) {
167+
sh '''#!/usr/bin/env bash
168+
YETUS_ARGS+=("--github-token=${GITHUB_TOKEN}")
169+
YETUS_ARGS+=("--patch-dir=${WORKSPACE}/${PATCHDIR}")
170+
TESTPATCHBIN="${WORKSPACE}/${YETUS}/precommit/src/main/shell/github-status-recovery.sh"
171+
/usr/bin/env bash "${TESTPATCHBIN}" "${YETUS_ARGS[@]}" ${EXTRA_ARGS} || true
172+
'''
173+
}
174+
168175
// Yetus output
169176
archiveArtifacts "${env.PATCHDIR}/**"
170177
// Publish the HTML report so that it can be looked at

dev-support/bin/checkcompatibility.py

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
#
33
# Licensed to the Apache Software Foundation (ASF) under one
44
# or more contributor license agreements. See the NOTICE file
@@ -30,33 +30,16 @@
3030
import shutil
3131
import subprocess
3232
import sys
33-
import urllib2
34-
try:
35-
import argparse
36-
except ImportError:
37-
sys.stderr.write("Please install argparse, e.g. via `pip install argparse`.")
38-
sys.exit(2)
33+
import urllib.request
34+
import argparse
3935

4036
# Various relative paths
4137
REPO_DIR = os.getcwd()
4238

4339
def check_output(*popenargs, **kwargs):
44-
r"""Run command with arguments and return its output as a byte string.
45-
Backported from Python 2.7 as it's implemented as pure python on stdlib.
46-
>>> check_output(['/usr/bin/python', '--version'])
47-
Python 2.6.2
48-
"""
49-
process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
50-
output, _ = process.communicate()
51-
retcode = process.poll()
52-
if retcode:
53-
cmd = kwargs.get("args")
54-
if cmd is None:
55-
cmd = popenargs[0]
56-
error = subprocess.CalledProcessError(retcode, cmd)
57-
error.output = output
58-
raise error
59-
return output
40+
""" Run command with arguments and return its output as a string. """
41+
return subprocess.check_output(*popenargs, **kwargs, encoding='utf-8')
42+
6043

6144
def get_repo_dir():
6245
""" Return the path to the top of the repo. """
@@ -139,7 +122,7 @@ def checkout_java_acc(force):
139122
url = "https://github.com/lvc/japi-compliance-checker/archive/1.8.tar.gz"
140123
scratch_dir = get_scratch_dir()
141124
path = os.path.join(scratch_dir, os.path.basename(url))
142-
jacc = urllib2.urlopen(url)
125+
jacc = urllib.request.urlopen(url)
143126
with open(path, 'wb') as w:
144127
w.write(jacc.read())
145128

@@ -194,7 +177,7 @@ def run_java_acc(src_name, src_jars, dst_name, dst_jars, annotations):
194177
annotations_path = os.path.join(get_scratch_dir(), "annotations.txt")
195178
with file(annotations_path, "w") as f:
196179
for ann in annotations:
197-
print >>f, ann
180+
print(ann, file=f)
198181
args += ["-annotations-list", annotations_path]
199182

200183
subprocess.check_call(args)
@@ -264,8 +247,8 @@ def main():
264247
parser.add_argument("--skip-build",
265248
action="store_true",
266249
help="Skip building the projects.")
267-
parser.add_argument("src_rev", nargs=1, help="Source revision.")
268-
parser.add_argument("dst_rev", nargs="?", default="HEAD",
250+
parser.add_argument("src_rev", nargs=1, type=str, help="Source revision.")
251+
parser.add_argument("dst_rev", nargs="?", type=str, default="HEAD",
269252
help="Destination revision. " +
270253
"If not specified, will use HEAD.")
271254

dev-support/bin/yetus-wrapper

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ WANTED="$1"
6363
shift
6464
ARGV=("$@")
6565

66-
HADOOP_YETUS_VERSION=${HADOOP_YETUS_VERSION:-0.3.0}
66+
HADOOP_YETUS_VERSION=${HADOOP_YETUS_VERSION:-0.13.0}
6767
BIN=$(yetus_abs "${BASH_SOURCE-$0}")
6868
BINDIR=$(dirname "${BIN}")
6969

dev-support/determine-flaky-tests-hadoop.py

Lines changed: 0 additions & 245 deletions
This file was deleted.

0 commit comments

Comments
 (0)