diff --git a/Changelog.md b/Changelog.md index 538823ab276438dcded1ce53d30cb2108c56679f..d6ffd02270ce2d93e9c0a824cc2b6246f2991428 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,9 @@ # Changelog +## [1.4.2] - 2019-03-14 +### Added +* option to specify the image name. Useful for inherent builds + ## [1.4.1] - 2019-03-13 ### Fixed * not testing for unused parameters because of reusing existing configs diff --git a/Readme.md b/Readme.md index 9d7a0acaa760508c60f7436d7c5a24dea1af210c..2a01ec4ea4448e8e4555af2401a0ef9618cc1817 100644 --- a/Readme.md +++ b/Readme.md @@ -90,6 +90,13 @@ From now on charts located in this repository can be deployed by using the `--ch ## docker init +* `--docker-config`: sets the content of the file `~/.docker/config.json` which is used by docker to authenticate to the registry. This can contain multiple registry-servers and there credentials. Which registry is used depends on the image name. +* `--cluster-url`: sets the url to the kube-apiserver. This URL is provided by the k8s-admin. +* `--certificate-authority`: sets the certificate-authority certificate as base64-encoded string. This string is provided by the k8s-admin +* `--token`: sets the bearer token of the service-account as bas64-encoded string. This string is provided by the k8s-admin. +* `--namespace`: sets the k8s-namespace where the deployment is located. This string is provided by the k8s-admin. +* `--service-account`: this is the name of the service-account, that is used to perform the deployment. +* `--reset`: this ignores eventually existing config-folders of docker, helm and kubectl and removes them. ## docker build @@ -98,16 +105,7 @@ From now on charts located in this repository can be deployed by using the `--ch * `--output`: sets the filepath to the file where the built image is saved. If omitted the image is not saved to a file. Also the script trys to import an eventually existing file prior to building in order to make usage of its layers as build-cache. * `--build-context`: sets the build-context for `docker build` to a custom path. If omitted the path where the command is invoked is used. * `--reset`: this ignores eventually existing config-folders of docker, helm and kubectl and removes them. - -## docker init - -* `--docker-config`: sets the content of the file `~/.docker/config.json` which is used by docker to authenticate to the registry. This can contain multiple registry-servers and there credentials. Which registry is used depends on the image name. -* `--cluster-url`: sets the url to the kube-apiserver. This URL is provided by the k8s-admin. -* `--certificate-authority`: sets the certificate-authority certificate as base64-encoded string. This string is provided by the k8s-admin -* `--token`: sets the bearer token of the service-account as bas64-encoded string. This string is provided by the k8s-admin. -* `--namespace`: sets the k8s-namespace where the deployment is located. This string is provided by the k8s-admin. -* `--service-account`: this is the name of the service-account, that is used to perform the deployment. -* `--reset`: this ignores eventually existing config-folders of docker, helm and kubectl and removes them. +* `--image-name`: sets the image name in the local docker-registry. Can be useful for following builds to build upon existing builds ## docker publish @@ -116,6 +114,7 @@ From now on charts located in this repository can be deployed by using the `--ch * `--name`: sets the name of the image. If you do not wish to publish to [Docker-Hub], you have to specify a server, e.g. `registry.example.com/my-image`. **Be aware that you need to provide credentials in your docker-config if the registry requires authentication. * `--tags`: sets the tags of the image. Provide multiple `--tag`-options if you wish to tag an image with multiple tags. * `--reset`: this ignores eventually existing config-folders of docker, helm and kubectl and removes them. +* `--image-name`: specifys the image name in the local docker-registry to publish ## docker deploy diff --git a/assets/deployer b/assets/deployer index d7ffaba7b900044c73efd7560711c13150b5593c..564247f6273c8e7730d29ca96c6757f0f2de0070 100755 --- a/assets/deployer +++ b/assets/deployer @@ -32,7 +32,7 @@ if [[ ${PIPESTATUS[0]} -ne 4 ]]; then fi OPTIONS= -LONGOPTS=docker-config:,tag:,build-arg:,values:,set:,set-string:,charts:,name:,token:,certificate-authority:,namespace:,cluster-url:,service-account:,output:,input:,repo-url:,build-context:,timeout:,reset +LONGOPTS=docker-config:,tag:,build-arg:,values:,set:,set-string:,charts:,name:,token:,certificate-authority:,namespace:,cluster-url:,service-account:,output:,input:,repo-url:,build-context:,timeout:,reset,image-name: # -use ! and PIPESTATUS to get exit code with errexit set # -temporarily store output to be able to check for errors @@ -114,6 +114,10 @@ while true; do reset="true" shift ;; + --image-name) + image_name="$2" + shift 2 + ;; --) shift break @@ -342,6 +346,10 @@ helm_undeploy() { } prepare_image_publisher() { + if [ "${dockerconfig}" == "" ];then + echo "No auth config found (you can provide the docker config via option --docker-config). Skipping" + return 0 + fi if [ "${reset}" == "true" ];then echo -ne "Removing \".docker\" folder (because \"--reset\" was provided) ..." @@ -358,14 +366,7 @@ prepare_image_publisher() { fi echo -ne "Setting docker auth config ..." - if [ "${dockerconfig}" == "" ];then - echo "failed! No auth config found" - echo "Please be sure to provide the docker config via option --docker-config" - return 1 - fi - mkdir -p ${HOME}/.docker && echo "${dockerconfig}" >${HOME}/.docker/config.json - if [ "$?" != "0" ];then echo "failed" return 1