Skip to content
This repository was archived by the owner on Nov 1, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ out/
# Gradle files
.gradle/
build/
!automation/docker/build

# Local configuration file (sdk path, etc)
local.properties
Expand Down
118 changes: 52 additions & 66 deletions .taskcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ tasks:
then: ${event.after}
else: ${event.release.tag_name}

push_date_time:
$if: 'tasks_for == "github-pull-request"'
then: ${event.pull_request.head.repo.pushed_at}
else:
$if: 'tasks_for == "github-push"'
then: ${event.repository.pushed_at}
else: ${event.release.published_at}

repository:
$if: 'tasks_for == "github-pull-request"'
then: ${event.pull_request.head.repo.html_url}
Expand All @@ -47,21 +39,25 @@ tasks:
then: focus-nightly-sched # TODO: Rename to mobile-nightly-sched
else: taskcluster-github

repo_trust_level:
is_repo_trusted:
# Pull requests on main repository can't be trusted because anybody can open a PR on it, without a review
$if: 'tasks_for in ["github-push", "github-release", "cron"] && event.repository.html_url == "https://github.com/mozilla-mobile/android-components"'
then: 3
else: 1

then: true
else: false
in:
$let:
is_repo_trusted:
$if: 'repo_trust_level == 3'
then: true
else: false
decision_worker_type:
$if: 'is_repo_trusted'
then: mobile-3-decision
else: mobile-1-decision

build_worker_type:
$if: 'is_repo_trusted'
then: mobile-3-b-andrcmp
else: mobile-1-b-andrcmp

tasks_priority:
$if: 'repo_trust_level == 3'
$if: 'is_repo_trusted'
then:
$if: 'tasks_for == "github-release"'
then: highest
Expand All @@ -70,7 +66,6 @@ tasks:
then: high
else: medium
else: lowest

in:
$let:
default_task_definition:
Expand All @@ -81,28 +76,19 @@ tasks:
deadline: {$fromNow: '2 hours'}
expires: ${expires_in}
provisionerId: aws-provisioner-v1
workerType: mobile-${repo_trust_level}-decision
workerType: ${decision_worker_type}
priority: ${tasks_priority}
requires: all-completed # Must be explicit because of Chain of Trust
retries: 5
scopes:
- queue:create-task:${tasks_priority}:aws-provisioner-v1/mobile-${repo_trust_level}-b-andrcmp
- queue:create-task:${tasks_priority}:aws-provisioner-v1/mobile-${repo_trust_level}-images
- queue:route:index.project.mobile.android-components.cache.level-${repo_trust_level}.docker-images.v1.*
- queue:create-task:${tasks_priority}:aws-provisioner-v1/${build_worker_type}
- queue:route:statuses
- queue:scheduler-id:${scheduler_id}
routes:
- statuses # Automatically added by taskcluster-github. It must be explicit because of Chain of Trust
payload:
maxRunTime: 600 # Decision should remain fast enough to schedule a handful of tasks
# XXX Even though this image is built on Taskcluster, we must upload it to Docker hub.
# The reason is: If we use the one hosted on Taskcluster, Chain of Trust will try to
# know the origin of docker image up until the very first one. This will become an issue
# one year after the first image was built: the artifacts will expire and Chain of Trust
# won't be able to know if the task was valid or not. This is why we keep uploading
# the docker image on Docker hub. The fact that the image is still built on Taskcluster
# is just a way of testing the Dockerfile.
image: mozillamobile/android-components-decision@sha256:7c4a815163ea22aa0df701d463a5764fb0122659b74d52868e662be28bdcb390
image: mozillamobile/android-components:1.15
command:
- /bin/bash
- --login
Expand All @@ -112,27 +98,12 @@ tasks:
TASK_ID: ${decision_task_id}
TASKS_PRIORITY: ${tasks_priority}
SCHEDULER_ID: ${scheduler_id}
BUILD_WORKER_TYPE: ${build_worker_type}
MOBILE_HEAD_REPOSITORY: ${repository}
MOBILE_HEAD_BRANCH: ${head_branch}
MOBILE_HEAD_REV: ${head_rev}
MOBILE_PUSH_DATE_TIME: ${push_date_time}
TRUST_LEVEL: ${repo_trust_level}
features:
taskclusterProxy: true
chainOfTrust: true # We sometimes build docker images in non-release graphs. We need to be able to trace them.
artifacts:
public/task-graph.json:
type: file
path: /build/android-components/task-graph.json
expires: ${expires_in}
public/actions.json:
type: file
path: /build/android-components/actions.json
expires: ${expires_in}
public/parameters.yml:
type: file
path: /build/android-components/parameters.yml
expires: ${expires_in}
extra:
tasks_for: ${tasks_for}
metadata:
Expand All @@ -151,6 +122,7 @@ tasks:
git fetch ${repository} ${head_branch}
&& git config advice.detachedHead false
&& git checkout ${head_rev}
&& ./gradlew --no-daemon --version
&& python automation/taskcluster/decision_task.py pr-or-push
in:
- $if: 'tasks_for == "github-pull-request" && event["action"] in ["opened", "reopened", "edited", "synchronize"]'
Expand All @@ -166,7 +138,6 @@ tasks:
- payload:
env:
GITHUB_PULL_TITLE: ${pull_request_title}
MOBILE_PULL_REQUEST_NUMBER: ${pull_request_number}
metadata:
name: 'Android Components - Decision task (Pull Request #${pull_request_number})'
description: 'Building and testing Android components - triggered by [#${pull_request_number}](${pull_request_url})'
Expand Down Expand Up @@ -212,7 +183,23 @@ tasks:
- queue:create-task:${tasks_priority}:scriptworker-prov-v1/${beetmover_worker_type}
payload:
env:
MOBILE_TRIGGERED_BY: ${user}
BEETMOVER_WORKER_TYPE: ${beetmover_worker_type}
features:
chainOfTrust: true
artifacts:
public/task-graph.json:
type: file
path: /build/android-components/task-graph.json
expires: ${expires_in}
public/actions.json:
type: file
path: /build/android-components/actions.json
expires: ${expires_in}
public/parameters.yml:
type: file
path: /build/android-components/parameters.yml
expires: ${expires_in}
in:
- $if: 'tasks_for == "github-release"'
then:
Expand All @@ -228,29 +215,28 @@ tasks:
git fetch ${repository} --tags
&& git config advice.detachedHead false
&& git checkout ${tag}
&& ./gradlew --no-daemon --version
&& python automation/taskcluster/decision_task.py release --version "${tag}"
${command_staging_flag}
metadata:
name: Android Components - Decision task (${tag})
description: Build and publish release versions.
- $if: 'tasks_for == "cron"'
then:
$let:
cron_task_id: {$eval: 'cron["task_id"]'}
in:
$mergeDeep:
- {$eval: 'default_task_definition'}
- {$eval: 'nightly_or_release_definition'}
- payload:
command:
- >-
git fetch ${repository} ${head_branch}
&& git config advice.detachedHead false
&& git checkout ${head_rev}
&& python automation/taskcluster/decision_task.py release --snapshot
${command_staging_flag}
extra:
cron: {$json: {$eval: 'cron'}}
metadata:
name: Android Components - Decision task for Snapshot release
description: Created by a [cron task](https://tools.taskcluster.net/tasks/${cron_task_id})
$mergeDeep:
- {$eval: 'default_task_definition'}
- {$eval: 'nightly_or_release_definition'}
- payload:
command:
- >-
git fetch ${repository} ${head_branch}
&& git config advice.detachedHead false
&& git checkout ${head_rev}
&& ./gradlew --no-daemon --version
&& python automation/taskcluster/decision_task.py release --snapshot
${command_staging_flag}
extra:
cron: {$json: {$eval: 'cron'}}
metadata:
name: Android Components - Decision task for Snapshot release
description: Schedules the snapshot release of Android components.
44 changes: 27 additions & 17 deletions automation/docker/build/Dockerfile → automation/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@ MAINTAINER Sebastian Kaspari "skaspari@mozilla.com"
#-- Configuration -----------------------------------------------------------------------------------------------------
#----------------------------------------------------------------------------------------------------------------------

ENV ANDROID_BUILD_TOOLS="28.0.3" \
ANDROID_HOME=/build/android-sdk \
ANDROID_SDK_HOME=/build/android-sdk \
ANDROID_SDK_VERSION="3859397" \
ANDROID_PLATFORM_VERSION="28" \
GRADLE_OPTS=-Xmx4096m -Dorg.gradle.daemon=false \
LANG=en_US.UTF-8 \
PROJECT_REPOSITORY="https://github.com/mozilla-mobile/android-components.git" \
TERM=dumb

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}
ENV ANDROID_BUILD_TOOLS "28.0.3"
ENV ANDROID_SDK_VERSION "3859397"
ENV ANDROID_PLATFORM_VERSION "28"
ENV PROJECT_REPOSITORY "https://github.com/mozilla-mobile/android-components.git"

ENV LANG en_US.UTF-8

# Do not use fancy output on taskcluster
ENV TERM dumb

ENV GRADLE_OPTS -Xmx4096m -Dorg.gradle.daemon=false

# Used to detect in scripts whether we are running on taskcluster
ENV CI_TASKCLUSTER true

#----------------------------------------------------------------------------------------------------------------------
#-- System ------------------------------------------------------------------------------------------------------------
Expand All @@ -30,17 +33,22 @@ 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 \
# python is still needed to fetch taskcluster secrets, for instance.
&& apt-get install -y curl \
&& apt-get install -y openjdk-8-jdk \
wget \
expect \
git \
locales \
openjdk-8-jdk \
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

#----------------------------------------------------------------------------------------------------------------------
Expand All @@ -50,8 +58,9 @@ RUN locale-gen en_US.UTF-8
RUN mkdir -p /build/android-sdk
WORKDIR /build

COPY requirements.txt requirements.txt
RUN pip --no-cache-dir install --require-hashes --requirement requirements.txt
ENV ANDROID_HOME /build/android-sdk
ENV ANDROID_SDK_HOME /build/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-${ANDROID_SDK_VERSION}.zip > sdk.zip \
&& unzip sdk.zip -d ${ANDROID_SDK_HOME} \
Expand All @@ -78,3 +87,4 @@ RUN ./gradlew clean \
&& ./gradlew --no-daemon ktlint \
&& ./gradlew --no-daemon docs \
&& ./gradlew clean

41 changes: 0 additions & 41 deletions automation/docker/build/requirements.txt

This file was deleted.

1 change: 0 additions & 1 deletion automation/docker/build/requirements.txt.in

This file was deleted.

20 changes: 0 additions & 20 deletions automation/docker/decision/Dockerfile

This file was deleted.

Loading