Skip to content

Commit

Permalink
Add support for login (#78)
Browse files Browse the repository at this point in the history
* Add support for login

* remove old function
  • Loading branch information
pvizeli authored Mar 23, 2021
1 parent ea39304 commit 5ae810f
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ DOCKER_LOCAL=false
VCN_NOTARY=false
VCN_FROM=
VCN_CACHE=
CODENOTARY_USER=
CODENOTARY_PASSWORD=
SELF_CACHE=false
CUSTOM_CACHE_TAG=
RELEASE_TAG=false
Expand Down Expand Up @@ -115,9 +117,9 @@ Options:
Set or overwrite the docker repository.
--docker-hub-check
Check if the version already exists before starting the build.
--docker-user
--docker-user <USER>
Username to login into docker with
--docker-password
--docker-password <PASSWORD>
Password to login into docker with
Use the host docker socket if mapped into container:
Expand All @@ -136,11 +138,8 @@ Options:
Build the machine based image for a release.
Security:
--with-codenotary
--with-codenotary <USER> <PASSWORD>
Enable signing images with CodeNotary. Need set follow env:
VCN_USER
VCN_PASSWORD
VCN_NOTARIZATION_PASSWORD
--validate-from <ORG|signer>
Validate the FROM image which is used to build the image.
--validate-cache <ORG|signer>
Expand Down Expand Up @@ -652,19 +651,12 @@ function init_crosscompile() {

#### Security CodeNotary ####

function codenotary_probe() {
if ! bashio::var.has_value "${VCN_USER}" || ! bashio::var.has_value "${VCN_PASSWORD}" || ! bashio::var.has_value "${VCN_NOTARIZATION_PASSWORD}"; then
bashio::exit.nok "Missing ENV values for CodeNotary"
fi
}


function codenotary_setup() {
if bashio::var.false "${DOCKER_PUSH}" || bashio::var.false "${VCN_NOTARY}"; then
return 0
fi

vcn login /dev/null 2>&1 || bashio::exit.nok "Login to CodeNotary fails!"
VCN_USER="${CODENOTARY_USER}" VCN_PASSWORD="${CODENOTARY_PASSWORD}" vcn login /dev/null 2>&1 || bashio::exit.nok "Login to CodeNotary fails!"
}

function codenotary_sign() {
Expand All @@ -674,7 +666,7 @@ function codenotary_sign() {
return 0
fi

vcn notarize --public "docker://${image}"
VCN_NOTARIZATION_PASSWORD="${CODENOTARY_PASSWORD}" vcn notarize --public "docker://${image}"
}

function codenotary_validate() {
Expand Down Expand Up @@ -835,8 +827,11 @@ while [[ $# -gt 0 ]]; do
shift
;;
--with-codenotary)
codenotary_probe
VCN_NOTARY=true
CODENOTARY_USER=$2
shift
CODENOTARY_PASSWORD=$2
shift
;;
--validate-from)
VCN_FROM=$2
Expand Down

0 comments on commit 5ae810f

Please sign in to comment.