Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for login #78

Merged
merged 2 commits into from
Mar 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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