@@ -0,0 +1,2150 @@
+#! /usr/bin/env python3%0A# Copyright 2022 Google LLC%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A#      http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in writing, software%0A# distributed under the License is distributed on an %22AS IS%22 BASIS,%0A# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A# See the License for the specific language governing permissions and%0A# limitations under the License.%0A#%0A################################################################################%0A%22%22%22Script for pushing manifest files to docker that point to AMD64 and ARM%0Aimages.%22%22%22%0Aimport logging%0Aimport subprocess%0Aimport sys%0A%0A%0Adef push_manifest(image):%0A  %22%22%22Pushes a manifest file in place of %7Cimage%7C for ARM and AMD64 versions of%0A  that image.%22%22%22%0A  subprocess.run(%5B'docker', 'pull', image%5D, check=True)%0A  amd64_image = f'%7Bimage%7D:manifest-amd64'%0A  subprocess.run(%5B'docker', 'tag', image, amd64_image%5D, check=True)%0A  subprocess.run(%5B'docker', 'push', amd64_image%5D, check=True)%0A%0A  arm_version = f'%7Bimage%7D-testing-arm'%0A  subprocess.run(%5B'docker', 'pull', arm_version%5D, check=True)%0A  arm64_image = f'%7Bimage%7D:manifest-arm64v8'%0A  subprocess.run(%5B'docker', 'tag', arm_version, arm64_image%5D, check=True)%0A%0A  subprocess.run(%5B%0A      'docker', 'manifest', 'create', image, '--amend', arm64_image, '--amend',%0A      amd64_image%0A  %5D,%0A                 check=True)%0A  subprocess.run(%5B'docker', 'manifest', 'push', image%5D, check=True)%0A  return True%0A%0A%0Adef main():%0A  %22%22%22Sets up manifests for base-builder and base-runner so they can be used for%0A  ARM builds.%22%22%22%0A  logging.info('Doing simple gcloud command to ensure 2FA passes. '%0A               'Otherwise docker push fails.')%0A  subprocess.run(%5B'gcloud', 'projects', 'list', '--limit=1'%5D, check=True)%0A%0A  images = %5B%0A      'gcr.io/oss-fuzz-base/base-builder', 'gcr.io/oss-fuzz-base/base-runner'%0A  %5D%0A  results = %5Bpush_manifest(image) for image in images%5D%0A  return 0 if all(results) else 1%0A%0A%0Aif __name__ == '__main__':%0A  sys.exit(main())%0A

Add manifest script (#8223)