Skip to content

Commit

Permalink
Backed out changeset 4f5f1b1d5d2c (bug 1731672) for linting failure. …
Browse files Browse the repository at this point in the history
…CLOSED TREE
  • Loading branch information
ncsoregi committed Oct 25, 2021
1 parent 6c9996e commit 3b86063
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 386 deletions.
1 change: 0 additions & 1 deletion taskcluster/ci/fetch/kind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ jobs-from:
- resource-monitor.yml
- toolchain-clang-tidy-external.yml
- toolchains.yml
- updatebot.yml
- visual-metrics.yml
27 changes: 0 additions & 27 deletions taskcluster/ci/fetch/updatebot.yml

This file was deleted.

38 changes: 1 addition & 37 deletions taskcluster/ci/updatebot/kind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
---
loader: gecko_taskgraph.loader.transform:loader

kind-dependencies:
- fetch

transforms:
- gecko_taskgraph.transforms.release_notifications:transforms
- gecko_taskgraph.transforms.job:transforms
Expand Down Expand Up @@ -62,44 +59,11 @@ jobs:
- hooks:trigger-hook:project-gecko/in-tree-action-1-generic/*
run:
using: run-task
command: /builds/worker/run.py /builds/worker/checkouts/gecko /builds/worker/updatebot
command: /builds/worker/run.py
notifications:
subject: 'updatebot cron failed'
message: 'updatebot cron failed'
status-types:
- on-failed
- on-exception
emails: ["tom@mozilla.com", "jewilde@mozilla.com"]

cron-win:
description: Cron Job for Updatebot (Windows)
run-on-projects: []
treeherder:
kind: other
platform: updatebot/all
symbol: w-cron
tier: 1
worker-type: b-win2012
worker:
max-run-time: 3600
taskcluster-proxy: true
env:
TOOLTOOL_MANIFEST: "taskcluster/ci/updatebot/tooltool-manifests/vc++-2019-runtime.manifest"
run:
using: run-task
cwd: '{checkout}'
command: ./taskcluster/docker/updatebot/windows-setup.sh
tooltool-downloads: internal
scopes:
- secrets:get:project/updatebot/{level}/try-sshkey
- secrets:get:project/updatebot/{level}/phabricator-token
- secrets:get:project/updatebot/{level}/bugzilla-api-key
- secrets:get:project/updatebot/{level}/database-password
- secrets:get:project/updatebot/{level}/sentry-url
- secrets:get:project/updatebot/{level}/sql-proxy-config
- hooks:trigger-hook:project-gecko/in-tree-action-1-generic/*
fetches:
fetch:
- cloud-sql-proxy-1.25.0
- php-windows-7.4.24
- arcanist

This file was deleted.

1 change: 0 additions & 1 deletion taskcluster/docker/updatebot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ MAINTAINER Tom Ritter <tom@mozilla.com>
VOLUME /builds/worker/checkouts

COPY privileged-setup.sh /setup/privileged-setup.sh
COPY updatebot-version.sh /setup/updatebot-version.sh
COPY setup.sh /builds/worker/setup.sh
COPY run.py /builds/worker/run.py
COPY hgrc /etc/mercurial/hgrc.d/updatebot.rc
Expand Down
19 changes: 0 additions & 19 deletions taskcluster/docker/updatebot/arcanist_windows_stream.patch

This file was deleted.

4 changes: 1 addition & 3 deletions taskcluster/docker/updatebot/hgrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[ui]
ssh = ssh -i $HOME/id_rsa -l updatebot@mozilla.com -o UserKnownHostsFile=$HOME/ssh_known_hosts
ssh = ssh -i /builds/worker/updatebot/id_rsa -l updatebot@mozilla.com
username = Updatebot <updatebot@mozilla.com>

[extensions]
strip =
push-to-try = $HOME/.mozbuild/version-control-tools/hgext/push-to-try
6 changes: 2 additions & 4 deletions taskcluster/docker/updatebot/privileged-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

set -vex

. ./updatebot-version.sh # Get UPDATEBOT_REVISION

# If you edit this, be sure to edit fetch/updatebot.yml
export UPDATEBOT_REVISION=d3d7a79ac23a1d2fac8c39a55f4e8818e6e51426
export SQLPROXY_REVISION=fb1939ab92846761595833361c6b0b0ecd543861

export DEBIAN_FRONTEND=noninteractive
Expand Down Expand Up @@ -53,7 +51,7 @@ go get github.com/GoogleCloudPlatform/cloudsql-proxy/cmd/cloud_sql_proxy@$SQLPRO
cd /builds/worker/
git clone https://github.com/mozilla-services/updatebot.git
cd updatebot
git checkout "$UPDATEBOT_REVISION"
git checkout $UPDATEBOT_REVISION

# Set up dependencies
cd /builds/worker/
Expand Down
89 changes: 24 additions & 65 deletions taskcluster/docker/updatebot/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,11 @@
import stat
import base64
import signal
import platform
import requests
import subprocess
import taskcluster

# Bump this number when you need to cause a commit for the job to re-run: 20

if len(sys.argv) < 3:
print("Usage:", sys.argv[0], "gecko-dev-path updatebot-path [moz-fetches-dir]")
sys.exit(1)

GECKO_DEV_PATH = sys.argv[1].replace("/", os.path.sep)
UPDATEBOT_PATH = sys.argv[2].replace("/", os.path.sep)

# Only needed on Windows
if len(sys.argv) > 3:
FETCHES_PATH = sys.argv[3].replace("/", os.path.sep)
else:
FETCHES_PATH = None

HOME_PATH = os.path.expanduser("~")
# Bump this number when you need to cause a commit for the job to re-run: 17

OPERATING_MODE = (
"prod"
Expand All @@ -43,6 +27,7 @@
else "dev"
)

GECKO_DEV_PATH = "/builds/worker/checkouts/gecko"
DEV_PHAB_URL = "https://phabricator-dev.allizom.org/"
PROD_PHAB_URL = "https://phabricator.services.mozilla.com/"

Expand Down Expand Up @@ -83,6 +68,8 @@ def get_secret(name):
sentry_url = get_secret("sentry-url")
sql_proxy_config = get_secret("sql-proxy-config")

os.chdir("/builds/worker/updatebot")

# Update Updatebot =======================================
if OPERATING_MODE == "dev":
"""
Expand All @@ -99,33 +86,19 @@ def get_secret(name):
Therefore, we only do this in dev mode when running on try.
"""

os.chdir(UPDATEBOT_PATH)
log("Performing git repo update...")
command = ["git", "symbolic-ref", "-q", "HEAD"]

r = subprocess.run(command)
r = subprocess.run(["git", "symbolic-ref", "-q", "HEAD"])
if r.returncode == 0:
# This indicates we are on a branch, and not a specific revision
subprocess.check_call(["git", "pull", "origin"])

# Set Up SSH & Phabricator ==============================
os.chdir(HOME_PATH)
log("Setting up ssh and phab keys...")
with open("id_rsa", "w") as sshkey:
sshkey.write(try_sshkey)
os.chmod("id_rsa", stat.S_IRUSR | stat.S_IWUSR)

arc_filename = ".arcrc"
if platform.system() == "Windows":
arc_path = os.path.join(FETCHES_PATH, "..", "AppData", "Roaming")
os.makedirs(arc_path, exist_ok=True)
os.chdir(arc_path)
log("Writing %s to %s" % (arc_filename, arc_path))
else:
os.chdir(HOME_PATH)

arcrc = open(arc_filename, "w")
arcrc = open("/builds/worker/.arcrc", "w")
towrite = """
{
"hosts": {
Expand All @@ -141,53 +114,41 @@ def get_secret(name):
)
arcrc.write(towrite)
arcrc.close()
os.chmod(arc_filename, stat.S_IRUSR | stat.S_IWUSR)
os.chmod("/builds/worker/.arcrc", stat.S_IRUSR | stat.S_IWUSR)

# Set up the Cloud SQL Proxy =============================
os.chdir(HOME_PATH)
log("Setting up cloud_sql_proxy...")
os.chdir("/builds/worker/")
with open("sql-proxy-key", "w") as proxy_key_file:
proxy_key_file.write(
base64.b64decode(sql_proxy_config["key-value"]).decode("utf-8")
)

instance_name = sql_proxy_config["instance-name"]
if platform.system() == "Linux":
sql_proxy_command = "/builds/worker/go/bin/cloud_sql_proxy"
else:
sql_proxy_command = os.path.join(UPDATEBOT_PATH, "..", "cloud_sql_proxy.exe")

sql_proxy_command += (
" -instances=" + instance_name + "=tcp:3306 -credential_file=sql-proxy-key"
sql_proxy_command = (
"./go/bin/cloud_sql_proxy -instances="
+ instance_name
+ "=tcp:3306 -credential_file=sql-proxy-key"
)
sql_proxy = subprocess.Popen(
sql_proxy_command,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True,
start_new_session=True,
)
sql_proxy_args = {
"stdout": subprocess.PIPE,
"stderr": subprocess.PIPE,
"shell": True,
"start_new_session": True,
}

if platform.system() == "Windows":
si = subprocess.STARTUPINFO()
si.dwFlags = subprocess.CREATE_NEW_PROCESS_GROUP

sql_proxy_args["startupinfo"] = si

sql_proxy = subprocess.Popen((sql_proxy_command), **sql_proxy_args)

try:
(stdout, stderr) = sql_proxy.communicate(input=None, timeout=2)
log("sql proxy stdout:", stdout.decode("utf-8"))
log("sql proxy stderr:", stderr.decode("utf-8"))
except subprocess.TimeoutExpired:
log("no sqlproxy output in 2 seconds, this means it probably didn't error.")
log("sqlproxy pid:", sql_proxy.pid)

database_config["host"] = "127.0.0.1"

# Vendor =================================================
log("Getting Updatebot ready...")
os.chdir(UPDATEBOT_PATH)
os.chdir("/builds/worker/updatebot")
localconfig = {
"General": {
"env": OPERATING_MODE,
Expand All @@ -214,10 +175,8 @@ def get_secret(name):
config.close()

log("Running updatebot")
# On Windows, Updatebot is run by windows-setup.sh
if platform.system() == "Linux":
subprocess.check_call(["python3", "-m", "poetry", "run", "./automation.py"])
subprocess.check_call(["poetry", "run", "./automation.py"])

# Clean up ===============================================
log("Killing cloud_sql_proxy")
os.kill(sql_proxy.pid, signal.SIGTERM)
# Clean up ===============================================
log("Killing cloud_sql_proxy")
os.killpg(sql_proxy.pid, signal.SIGTERM)
4 changes: 1 addition & 3 deletions taskcluster/docker/updatebot/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

set -vex

# Copy the system known_hosts to the home directory so we have uniformity with Windows
# and the ssh command will find them in the same place.
cp /etc/ssh/ssh_known_hosts $HOME/ssh_known_hosts
whoami

# If poetry is not run as worker, then it won't work when run as user later.
cd /builds/worker/updatebot
Expand Down
1 change: 0 additions & 1 deletion taskcluster/docker/updatebot/updatebot-version.sh

This file was deleted.

Loading

0 comments on commit 3b86063

Please sign in to comment.