Commit 70c11d54 authored by Tom Powell's avatar Tom Powell

It's live!

parent ae86c545
Pipeline #34769130 canceled with stages
stages:
- build
- sign
build:
stage: build
tags:
- lineage-builder
variables:
USE_CCACHE: "1"
PYTHONDONTWRITEBYTECODE: "true"
BUILD_ENFORCE_SELINUX: "1"
BUILD_NO: $CI_PIPELINE_ID
BUILD_NUMBER: ""
# the following are added when triggered from API
# VERSION
# DEVICE
# TYPE
script:
- sleep 60
- if (( RANDOM % 2 )); then exit 2; fi
- |
cd /lineage/${VERSION}
rm -rf .repo/local_manifests/*
if [ -f /lineage/setup.sh ]; then
source /lineage/setup.sh
fi
repo init -u https://github.com/lineageos/android.git -b ${VERSION}
echo "Resetting build tree"
repo forall -vc "git reset --hard" > /dev/null 2> /dev/null
echo "Syncing"
repo sync -j32 -d --force-sync > /dev/null 2> /dev/null
. build/envsetup.sh
mka clobber
set +e
breakfast lineage_${DEVICE}-${TYPE}
set -e
mka otatools-package target-files-package dist
ssh [email protected] mkdir -p /home/jenkins/incoming/${DEVICE}/${CI_PIPELINE_ID}/
scp out/dist/*target_files*.zip [email protected]:/home/jenkins/incoming/${DEVICE}/${CI_PIPELINE_ID}/
scp out/target/product/${DEVICE}/otatools.zip [email protected]:/home/jenkins/incoming/${DEVICE}/${CI_PIPELINE_ID}/
only:
- triggers
- web
sign:
stage: sign
image: python:3.6
tags:
- signing-proxy
script:
- echo NYI
- pip install -r requirements.txt
- source /home/gitlab-runner/env.sh
- python sign.py
only:
- triggers
- web
......@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2018 LineageOS / LineageOS Builder
Copyright 2018 LineageOS / builds
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
......
from datetime import datetime
from urllib.parse import quote_plus
import requests
import os
import sys
import time
project = os.environ.get('GITLAB_SIGNING_PROJECT')
trigger_token = os.environ.get("GITLAB_TRIGGER_TOKEN")
access_token = os.environ.get("GITLAB_ACCESS_TOKEN")
if not project or not trigger_token or not access_token:
print('GITLAB_SIGNING_PROJECT, GITLAB_TRIGGER_TOKEN, and GITLAB_ACCESS_TOKEN required')
sys.exit(1)
project = quote_plus(project)
def start(device, pipeline_id):
gitlab_url = f"https://gitlab.com/api/v4/projects/{project}/trigger/pipeline?token={trigger_token}&ref=master"
data = {
"variables[DEVICE]": device,
"variables[PIPELINE_ID]": pipeline_id
}
req = requests.post(gitlab_url, data)
if req.status_code == 201:
print("Started at ", req.json()['web_url'])
return req.json()['id']
else:
print("ERROR", req.status_code, req.text)
def main():
pipeline_id = start(os.environ.get("DEVICE"), os.environ.get("CI_PIPELINE_ID"))
status = "pending"
gitlab_url = f"https://gitlab.com/api/v4/projects/{project}/pipelines/{pipeline_id}"
headers = {'Private-Token': access_token}
while True:
resp = requests.get(gitlab_url, headers=headers)
if resp.status_code == 200:
status = resp.json().get("status")
if status == "success":
print("SUCCESS")
sys.exit(0)
elif status == "pending" or status == "running":
print("Still waiting...")
pass
else:
print("FAILURE")
print(status)
sys.exit(0)
time.sleep(10)
if __name__ == '__main__':
main()
Markdown is supported
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