help='always show output from running a container')
parser.add_argument('--test', action='store_true',
help='test the release')
+ parser.add_argument('--test-aarch64', action='store_true',
+ help='test the release for ARM64')
parser.add_argument('--verbose', action='store_true',
help='verbose output')
parser.add_argument('--version', action='store_true',
tpl = g_env.get_template('pdns-list.jinja2')
if os in ['debian', 'ubuntu']:
- arch = ' [arch=amd64] '
+ arch = ' [arch=amd64,arm64] '
else:
arch = ' '
# Test Release Functions
-def build (dockerfile):
+def build (dockerfile, arch='x86_64'):
# Maybe create `determine_tag` function.
if len(str(dockerfile)) <= len(g_dockerfile):
print('Unable to determine tag for {}'.format(dockerfile))
print('Building Docker image using {}...'.format(dockerfile))
if g_verbose:
print(' - tag = {}'.format(tag))
- cp = subprocess.run(['docker', 'build', '--no-cache', '--pull', '--file',
- dockerfile, '--tag', tag, '.'],
- capture_output=not(g_verbose))
+ if arch == 'x86_64':
+ cp = subprocess.run(['docker', 'build', '--no-cache', '--pull',
+ '--file', dockerfile, '--tag', tag, '.'],
+ capture_output=not(g_verbose))
+ # not very subtle
+ elif arch == 'aarch64':
+ cp = subprocess.run(['docker', 'build', '--platform', 'linux/arm64/v8',
+ '--no-cache', '--pull', '--file', dockerfile,
+ '--tag', tag, '.'],
+ capture_output=not(g_verbose))
# FIXME write failed output to log
if cp.returncode != 0:
print('Error building {}: {}'.format(tag, repr(cp.returncode)))
return ( tag, cp.returncode )
-def run (tag):
+def run (tag, arch='x86_64'):
if g_run_output:
capture_run_output = False
else:
capture_run_output = not(g_verbose)
print('Running Docker container tagged {}...'.format(tag))
- cp = subprocess.run(['docker', 'run', tag],
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ if arch == 'x86_64':
+ cp = subprocess.run(['docker', 'run', tag],
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ # not very subtle
+ elif arch == 'aarch64':
+ cp = subprocess.run(['docker', 'run', '--platform', 'linux/arm64/v8',
+ tag],
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
version = re.search(r'(PowerDNS Authoritative Server|PowerDNS Recursor|' +
r'dnsdist) (\d+\.\d+\.\d+(-\w+)?)',
cp.stdout.decode())
return files
-def test_release (release):
+def test_release (release, arch='x86_64'):
# sorted because we want determinism
dockerfiles = sorted(collect_dockerfiles(release))
failed_builds = []
failed_runs = []
returned_versions = []
- print('=== testing {} ==='.format(release))
+ print('=== testing {} ({}) ==='.format(release, arch))
for df in dockerfiles:
+ if arch == 'aarch64' and str(df).endswith('centos-7'):
+ continue
+ if arch == 'aarch64' and not release in ['rec-51', 'rec-master',
+ 'dnsdist-19', 'dnsdist-master']:
+ continue
if g_verbose:
print('--- {} ---'.format(df))
- (tag, returncode) = build(df)
+ (tag, returncode) = build(df, arch)
if returncode != 0:
print('Skipping running {} due to build error: {}'
.format(df, returncode))
print('Skipping running {} due to undetermined tag.'.format(df))
failed_builds.append((str(df), returncode))
else:
- (returncode, return_version) = run(tag)
+ (returncode, return_version) = run(tag, arch)
# for some reason 99 is returned on `cmd --version` :shrug:
# (not sure if this is true since using `stdout=PIPE...`)
if returncode != 0 and returncode != 99:
if args.test:
test_release(args.release)
+
+if args.test_aarch64:
+ test_release(args.release, 'aarch64')