Unverified Commit 699d5b7b authored by Johan Lorenzo's avatar Johan Lorenzo Committed by GitHub
Browse files

Bug 1620190 - Run android-components bumps once a day (#9251)

parent e9738725
......@@ -30,3 +30,9 @@ jobs:
treeherder-symbol: btime-D
target-tasks-method: browsertime
when: [{hour: 1, minute: 0}]
- name: bump-android-components
job:
type: decision-task
treeherder-symbol: bump-ac
target-tasks-method: bump_android_components
when: [{hour: 14, minute: 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/.
# If a command fails then do not proceed and fail this script too.
set -ex
export BRANCH="ac-update"
export GITHUB_USER="MickeyMoz"
export EMAIL="sebastian@mozilla.com"
export REPO="fenix"
git config --global user.email "$EMAIL"
git config --global user.name "$GITHUB_USER"
COMPONENT_TO_WATCH='browser-engine-gecko-nightly'
MAVEN_URL="https://nightly.maven.mozilla.org/maven2/org/mozilla/components/$COMPONENT_TO_WATCH"
# Fetch latest version
LATEST_VERSION=$(curl "$MAVEN_URL/maven-metadata.xml" | sed -ne '/latest/{s/.*<latest>\(.*\)<\/latest>.*/\1/p;q;}')
# Check the latest version was uploaded by Mozilla
LATEST_POM_URL="$MAVEN_URL/$LATEST_VERSION/$COMPONENT_TO_WATCH-$LATEST_VERSION.pom"
POM_FILE='component.pom'
$CURL "$LATEST_POM_URL" --output "$POM_FILE"
$CURL "$LATEST_POM_URL.asc" --output "$POM_FILE.asc"
gpg --verify "$POM_FILE.asc" "$POM_FILE"
# Updating version file
sed -i "s/VERSION = \".*\"/VERSION = \"$LATEST_VERSION\"/g" "buildSrc/src/main/java/AndroidComponents.kt"
# Create a branch and commit local changes
git checkout -b "$BRANCH"
git add buildSrc/src/main/java/AndroidComponents.kt
git commit -m \
"Update Android Components version to $LATEST_VERSION." \
--author="MickeyMoz <sebastian@mozilla.com>" \
|| { echo "No new Android Components version ($LATEST_VERSTION) available"; exit 0; }
# From here on we do not want to print the commands since they contain tokens
set +x
export GITHUB_TOKEN=$(cat .github_token)
if [[ $GITHUB_TOKEN == 'faketoken' ]]; then
echo '"faketoken" detected, not pushing anything'
exit 0
fi
# Push changes to GitHub
echo "Pushing branch to GitHub"
URL="https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/$GITHUB_USER/$REPO/"
# XXX git sometimes leaks the URL including the token when the network request failed (regardless of --quiet).
git push --force --no-verify --quiet "$URL" "$BRANCH" > /dev/null 2>&1 || echo "Failed ($?)"
# Open a PR if needed
if [[ $(hub pr list --head "$GITHUB_USER:$BRANCH") ]]; then
echo "There's already an open PR."
else
echo "No PR found. Opening new PR."
hub pull-request --base master --head "$GITHUB_USER:$BRANCH" --no-edit -m "Update Android Components version"
fi
unset GITHUB_TOKEN
# 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/.
---
loader: taskgraph.loader.transform:loader
kind-dependencies: []
transforms:
- fenix_taskgraph.transforms.secrets:transforms
- taskgraph.transforms.job:transforms
- taskgraph.transforms.task:transforms
job-defaults:
treeherder:
kind: build
symbol: bump(a-c)
tier: 2
platform: android-all/opt
run-on-tasks-for: []
run:
dummy-secrets:
by-level:
'3': []
default:
- content: "faketoken"
path: .github_token
secrets:
by-level:
'3':
- name: project/mobile/github
key: botAccountToken
path: .github_token
default: []
using: run-commands
use-caches: false
worker-type: b-android
worker:
docker-image: {in-tree: bump}
max-run-time: 7200
chain-of-trust: true
jobs:
android-components:
attributes:
bump-type: android-components
description: Bump android-components to the latest version
run:
commands:
- [automation/taskcluster/update_android_components.sh]
......@@ -4,6 +4,7 @@ treeherder:
group-names:
'beta': 'Beta-related tasks'
'betaFennec': 'Beta-related tasks with same APK configuration as Fennec'
'bump': 'Bump dependencies'
'debug': 'Builds made for testing'
'forPerformanceTest': 'Builds made for Raptor and other performance tests'
'I': 'Docker Image Builds'
......
......@@ -13,6 +13,9 @@ transforms:
jobs:
base:
symbol: I(base)
bump:
parent: base
symbol: I(bump)
nimbledroid:
parent: base
symbol: I(nimbledroid)
......
......@@ -5,7 +5,7 @@
loader: taskgraph.loader.transform:loader
transforms:
- fenix_taskgraph.transforms.nimbledroid:transforms
- fenix_taskgraph.transforms.secrets:transforms
- taskgraph.transforms.job:transforms
- taskgraph.transforms.task:transforms
......@@ -27,10 +27,10 @@ job-defaults:
default: []
dummy-secrets:
by-level:
'3': []
default:
- content: "faketoken"
path: .nimbledroid_token
'3': []
default:
- content: "faketoken"
path: .nimbledroid_token
run-on-tasks-for: []
treeherder:
kind: test
......
......@@ -19,8 +19,10 @@ WORKDIR /builds/worker/
#-- Configuration -----------------------------------------------------------------------------------------------------
#----------------------------------------------------------------------------------------------------------------------
ENV ANDROID_SDK_VERSION='3859397' \
ENV ANDROID_SDK_SHA256='444e22ce8ca0f67353bda4b85175ed3731cae3ffa695ca18119cbacef1c1bea0' \
ANDROID_SDK_VERSION='3859397' \
ANDROID_SDK_ROOT='/builds/worker/android-sdk-linux' \
CURL='curl --location --retry 5' \
GRADLE_OPTS='-Xmx4096m -Dorg.gradle.daemon=false' \
LANG='en_US.UTF-8' \
TERM='dumb' \
......@@ -52,7 +54,8 @@ RUN pip install taskcluster
RUN locale-gen "$LANG"
RUN curl -o "$SDK_ZIP_LOCATION" "https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_VERSION}.zip" \
RUN $CURL --output "$SDK_ZIP_LOCATION" "https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_VERSION}.zip" \
&& echo "$ANDROID_SDK_SHA256 $SDK_ZIP_LOCATION" | sha256sum --check \
&& unzip -d "$ANDROID_SDK_ROOT" "$SDK_ZIP_LOCATION" \
&& rm "$SDK_ZIP_LOCATION" \
&& yes | "${ANDROID_SDK_ROOT}/tools/bin/sdkmanager" --licenses \
......@@ -63,7 +66,7 @@ RUN curl -o "$SDK_ZIP_LOCATION" "https://dl.google.com/android/repository/sdk-to
ENV SHELL=/bin/bash \
HOME=/builds/worker \
PATH=/builds/worker/.local/bin:$PATH
PATH="/builds/worker/.local/bin:$PATH"
VOLUME /builds/worker/checkouts
......
# %ARG DOCKER_IMAGE_PARENT
FROM $DOCKER_IMAGE_PARENT
MAINTAINER Johan Lorenzo <jlorenzo+tc@mozilla.com>
USER worker:worker
ENV HUB_ARCHIVE='hub.tgz' \
HUB_ROOT='/builds/worker/hub' \
HUB_SHA256='734733c9d807715a4ec26ccce0f9987bd19f1c3f84dd35e56451711766930ef0' \
HUB_VERSION='2.14.1'
RUN $CURL --output "$HUB_ARCHIVE" "https://github.com/github/hub/releases/download/v$HUB_VERSION/hub-linux-amd64-$HUB_VERSION.tgz" \
&& echo "$HUB_SHA256 $HUB_ARCHIVE" | sha256sum --check \
&& mkdir -p "$HUB_ROOT" \
&& tar xzvf "$HUB_ARCHIVE" --strip-components=1 --directory="$HUB_ROOT" \
&& rm "$HUB_ARCHIVE"
ENV PATH="$HUB_ROOT/bin:$PATH"
COPY mozilla_key.asc owner_trust.db ./
RUN gpg --import mozilla_key.asc \
&& gpg --import-ownertrust owner_trust.db \
&& rm mozilla_key.asc owner_trust.db
# run-task expects to run as root
USER root
This diff is collapsed.
# List of assigned trustvalues
# (Use "gpg --import-ownertrust" to restore them)
14F26682D0916CDD81E37B6D61B7B526D98F0353:6:
......@@ -53,9 +53,20 @@ def target_tasks_raptor(full_task_graph, parameters, graph_config):
return [l for l, t in full_task_graph.tasks.iteritems() if filter(t, parameters)]
@_target_task('browsertime')
def target_tasks_raptor(full_task_graph, parameters, graph_config):
def filter(task, parameters):
return task.kind in ('browsertime', 'visual-metrics')
return [l for l, t in full_task_graph.tasks.iteritems() if filter(t, parameters)]
@_target_task("bump_android_components")
def target_tasks_bump_android_components(full_task_graph, parameters, graph_config):
"""Select the set of tasks required to update android components."""
def filter(task, parameters):
return task.attributes.get("bump-type", "") == "android-components"
return [l for l, t in full_task_graph.tasks.iteritems() if filter(t, parameters)]
......@@ -2,8 +2,7 @@
# 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/.
"""
Apply some defaults and minor modifications to the jobs defined in the nimbledroid
kind.
Resolve secrets and dummy secrets
"""
from __future__ import absolute_import, print_function, unicode_literals
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment