Skip to content
Snippets Groups Projects
Commit 43c322f2 authored by Ulf Seltmann's avatar Ulf Seltmann
Browse files

added new option --image-name

parent 5c0910ce
Branches
No related merge requests found
Pipeline #1636 passed with stages
in 3 minutes and 7 seconds
# 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
......
......@@ -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
......
......@@ -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
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment