1*387f9dfdSAndroid Build Coastguard Worker#!/bin/bash 2*387f9dfdSAndroid Build Coastguard Workerset -e 3*387f9dfdSAndroid Build Coastguard Worker 4*387f9dfdSAndroid Build Coastguard Worker# For now only quay.io is supported, but this could be portable to dockerhub 5*387f9dfdSAndroid Build Coastguard Worker# and other image repositories. 6*387f9dfdSAndroid Build Coastguard Worker 7*387f9dfdSAndroid Build Coastguard Worker# Forks can push using this approach if they create a quay.io bot user 8*387f9dfdSAndroid Build Coastguard Worker# with name matching of ORGNAME+bcc_buildbot, or by setting QUAY_BOT_NAME 9*387f9dfdSAndroid Build Coastguard Worker 10*387f9dfdSAndroid Build Coastguard Workergit_repo=$1 # github.repository format: ORGNAME/REPONAME 11*387f9dfdSAndroid Build Coastguard Worker 12*387f9dfdSAndroid Build Coastguard Worker# Set this value as QUAY_TOKEN in the github repository settings "Secrets" tab 13*387f9dfdSAndroid Build Coastguard Worker[[ -z "${QUAY_TOKEN}" ]] && echo "QUAY_TOKEN not set" && exit 0 14*387f9dfdSAndroid Build Coastguard Worker 15*387f9dfdSAndroid Build Coastguard Worker# Set this to match the name of the bot user on quay.io 16*387f9dfdSAndroid Build Coastguard Worker[[ -z "${QUAY_BOT_NAME}" ]] && QUAY_BOT_NAME="bcc_buildbot" 17*387f9dfdSAndroid Build Coastguard Worker 18*387f9dfdSAndroid Build Coastguard Workerquay_user="$(dirname ${git_repo})+${QUAY_BOT_NAME}" 19*387f9dfdSAndroid Build Coastguard Workerecho "${QUAY_TOKEN}" | docker login -u="${quay_user}" --password-stdin quay.io 20