From dd5a1a5d0c849d39096a01ab221125c72a9ccc36 Mon Sep 17 00:00:00 2001 From: Johan Lorenzo Date: Fri, 18 Oct 2019 17:20:44 +0200 Subject: [PATCH] Clean up automation folder from what was used by the old decision task --- automation/__init__.py | 0 automation/docker/Dockerfile | 85 ------------------- automation/taskcluster/__init__.py | 0 taskcluster/fenix_taskgraph/job.py | 2 +- .../scripts}/get-secret.py | 9 +- 5 files changed, 7 insertions(+), 89 deletions(-) delete mode 100644 automation/__init__.py delete mode 100644 automation/docker/Dockerfile delete mode 100644 automation/taskcluster/__init__.py rename {automation/taskcluster/helper => taskcluster/scripts}/get-secret.py (92%) diff --git a/automation/__init__.py b/automation/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/automation/docker/Dockerfile b/automation/docker/Dockerfile deleted file mode 100644 index e11f95317..000000000 --- a/automation/docker/Dockerfile +++ /dev/null @@ -1,85 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -# Inspired by: -# https://hub.docker.com/r/runmymind/docker-android-sdk/~/dockerfile/ - -FROM ubuntu:18.04 - -MAINTAINER Sebastian Kaspari "skaspari@mozilla.com" - -# -- Configuration ---------------------------------------------------------------------- - -ENV GOOGLE_SDK_VERSION 233 - -# -- System ----------------------------------------------------------------------------- - -RUN apt-get update -qq \ - # We need to install tzdata before all of the other packages. Otherwise it will show an interactive dialog that - # we cannot navigate while building the Docker image. - && apt-get install -y tzdata \ - && apt-get install -y openjdk-8-jdk \ - wget \ - expect \ - git \ - curl \ - python \ - python-pip \ - locales \ - unzip \ - && apt-get clean - -RUN pip install --upgrade pip -RUN pip install 'taskcluster>=4,<5' -RUN pip install arrow -RUN pip install pyyaml - -RUN locale-gen en_US.UTF-8 - -# -- Android SDK ------------------------------------------------------------------------ - -RUN mkdir -p /opt/android-sdk -WORKDIR /opt - -ENV ANDROID_BUILD_TOOLS "28.0.3" -ENV ANDROID_HOME /opt/android-sdk -ENV ANDROID_SDK_HOME /opt/android-sdk -ENV PATH ${PATH}:${ANDROID_SDK_HOME}/tools:${ANDROID_SDK_HOME}/tools/bin:${ANDROID_SDK_HOME}/platform-tools:/opt/tools:${ANDROID_SDK_HOME}/build-tools/${ANDROID_BUILD_TOOLS} - -RUN curl -L https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip > sdk.zip \ - && unzip sdk.zip -d ${ANDROID_SDK_HOME} \ - && rm sdk.zip - -RUN mkdir -p /opt/android-sdk/.android/ -RUN touch /opt/android-sdk/.android/repositories.cfg - -RUN yes | sdkmanager --licenses - -# Checkout source code -RUN git clone https://github.com/mozilla-mobile/fenix.git - -# -- Test tools ------------------------------------------------------------------------- - -RUN mkdir -p /build/test-tools - -WORKDIR /build - -ENV TEST_TOOLS /build/test-tools -ENV GOOGLE_SDK_DOWNLOAD ./gcloud.tar.gz -ENV PATH ${PATH}:${TEST_TOOLS}:${TEST_TOOLS}/google-cloud-sdk/bin - -RUN curl https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GOOGLE_SDK_VERSION}.0.0-linux-x86_64.tar.gz --output ${GOOGLE_SDK_DOWNLOAD} \ - && tar -xvf ${GOOGLE_SDK_DOWNLOAD} -C ${TEST_TOOLS} \ - && rm -f ${GOOGLE_SDK_DOWNLOAD} \ - && ${TEST_TOOLS}/google-cloud-sdk/install.sh --quiet \ - && ${TEST_TOOLS}/google-cloud-sdk/bin/gcloud --quiet components update - -RUN URL_FLANK_BIN=$(curl -s "https://api.github.com/repos/TestArmada/flank/releases/latest" | grep "browser_download_url*" | sed -r "s/\"//g" | cut -d ":" -f3) \ - && wget "https:${URL_FLANK_BIN}" -O ${TEST_TOOLS}/flank.jar \ - && chmod +x ${TEST_TOOLS}/flank.jar - -# Build project and run gradle tasks once to pull all dependencies -WORKDIR /opt/fenix -RUN ./gradlew -PversionName=0.0 --no-daemon assemble test lint \ - && ./gradlew clean \ No newline at end of file diff --git a/automation/taskcluster/__init__.py b/automation/taskcluster/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/taskcluster/fenix_taskgraph/job.py b/taskcluster/fenix_taskgraph/job.py index 3b47ed597..1f1b21622 100644 --- a/taskcluster/fenix_taskgraph/job.py +++ b/taskcluster/fenix_taskgraph/job.py @@ -71,7 +71,7 @@ def _extract_command(run): def _generate_secret_command(secret): secret_command = [ - "automation/taskcluster/helper/get-secret.py", + "taskcluster/scripts/get-secret.py", "-s", secret["name"], "-k", secret["key"], "-f", secret["path"], diff --git a/automation/taskcluster/helper/get-secret.py b/taskcluster/scripts/get-secret.py similarity index 92% rename from automation/taskcluster/helper/get-secret.py rename to taskcluster/scripts/get-secret.py index c10af239a..90e559a0d 100755 --- a/automation/taskcluster/helper/get-secret.py +++ b/taskcluster/scripts/get-secret.py @@ -4,21 +4,24 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. +from __future__ import absolute_import, print_function, unicode_literals + import argparse import base64 +import errno import json import os - -import errno import taskcluster + def write_secret_to_file(path, data, key, base64decode=False, json_secret=False, append=False, prefix=''): - path = os.path.join(os.path.dirname(__file__), '../../../' + path) + path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../' + path)) try: os.makedirs(os.path.dirname(path)) except OSError as error: if error.errno != errno.EEXIST: raise + print("Outputting secret to: {}".format(path)) with open(path, 'a' if append else 'w') as f: value = data['secret'][key]