mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-22 15:02:23 +00:00
Fix references in deploy-to-resin.js and use github credentials when pushing in pr-to-meta-resin.sh
deploy-to-resin.js had a few references to variables that are no longer defined. In pr-to-meta-resin.sh, the passing of GitHub credentials was wrongly placed and messy. As per @Page-'s advice, we use the credentials as part of the remote url when pushing (we don't do it when cloning to avoid the github password being visible with a `git remote -v`). We change GITHUB_USERNAME to GITHUB_USER as hub will automatically pick it up, avoiding the need to pass the credentials when creating the PR. Change-Type: patch Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This commit is contained in:
parent
bdf6214d12
commit
925112bd13
@ -68,7 +68,7 @@ resinApi._request(_.extend({
|
|||||||
if (_.isEmpty(apiToken)) {
|
if (_.isEmpty(apiToken)) {
|
||||||
customOptions.apikey = apikey;
|
customOptions.apikey = apikey;
|
||||||
}
|
}
|
||||||
console.log(`Deploying ${supervisor_version} for ${device_type}`);
|
console.log(`Deploying ${tag} for ${deviceType.slug}`);
|
||||||
return resinApi.post({
|
return resinApi.post({
|
||||||
resource: 'supervisor_release',
|
resource: 'supervisor_release',
|
||||||
body: {
|
body: {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#
|
#
|
||||||
# If $PR_1X is "true", an additional PR for 1.X will be created.
|
# If $PR_1X is "true", an additional PR for 1.X will be created.
|
||||||
#
|
#
|
||||||
# Requires $GITHUB_USERNAME and $GITHUB_PASSWORD to push and create the pull-request.
|
# Requires $GITHUB_USER and $GITHUB_PASSWORD to push and create the pull-request.
|
||||||
# Requires $TAG to be set to the supervisor version to use.
|
# Requires $TAG to be set to the supervisor version to use.
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -18,11 +18,13 @@ if [ -z "$TAG" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$GITHUB_PASSWORD" || -z "$GITHUB_USERNAME" ]]; then
|
if [[ -z "$GITHUB_PASSWORD" || -z "$GITHUB_USER" ]]; then
|
||||||
echo "GITHUB_USERNAME and GITHUB_PASSWORD are required"
|
echo "GITHUB_USER and GITHUB_PASSWORD are required"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
REPO_URL=https://github.com/resin-os/meta-resin.git
|
||||||
|
REPO_URL_WITH_CREDENTIALS=https://${GITHUB_USER}:${GITHUB_PASSWORD}@github.com/resin-os/meta-resin.git
|
||||||
USER=${USER:-$(whoami)}
|
USER=${USER:-$(whoami)}
|
||||||
|
|
||||||
function prepareBranches() {
|
function prepareBranches() {
|
||||||
@ -48,25 +50,20 @@ docker-resin-supervisor-disk: Update to ${TAG}
|
|||||||
|
|
||||||
Changelog-Entry: Update supervisor to ${TAG}
|
Changelog-Entry: Update supervisor to ${TAG}
|
||||||
Change-Type: patch
|
Change-Type: patch
|
||||||
" <<EOF
|
"
|
||||||
${GITHUB_USERNAME}
|
|
||||||
${GITHUB_PASSWORD}
|
git push $REPO_URL_WITH_CREDENTIALS $HEAD
|
||||||
EOF
|
|
||||||
|
|
||||||
git push origin $HEAD
|
|
||||||
hub pull-request -b ${BASE} -m "${BASE}: Update supervisor to ${TAG}
|
hub pull-request -b ${BASE} -m "${BASE}: Update supervisor to ${TAG}
|
||||||
|
|
||||||
Change-Type: patch
|
Change-Type: patch
|
||||||
" <<EOF
|
"
|
||||||
${GITHUB_USERNAME}
|
|
||||||
${GITHUB_PASSWORD}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ ! -d "./meta-resin" ]; then
|
if [ ! -d "./meta-resin" ]; then
|
||||||
echo "Cloning meta-resin..."
|
echo "Cloning meta-resin..."
|
||||||
git clone https://github.com/resin-os/meta-resin.git
|
git clone $REPO_URL
|
||||||
else
|
else
|
||||||
echo "Using available meta-resin repo"
|
echo "Using available meta-resin repo"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user