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