@@ -40,7 +40,7 @@ <h1 class="title">Module <code>gcip.addons.kaniko.jobs</code></h1>
4040
4141
4242def execute(
43- gitlab_executor_image: Optional[Union[Image, str]] = Image("gcr.io/kaniko-project/executor:latest ", entrypoint=[""]),
43+ gitlab_executor_image: Optional[Union[Image, str]] = Image("gcr.io/kaniko-project/executor:debug ", entrypoint=[""]),
4444 context: Optional[str] = None,
4545 image_name: Optional[str] = None,
4646 image_tag: Optional[str] = None,
@@ -116,6 +116,9 @@ <h1 class="title">Module <code>gcip.addons.kaniko.jobs</code></h1>
116116
117117 executor_cmd: List[str] = ["executor"]
118118
119+ if not context and PredefinedVariables.CI_PROJECT_DIR:
120+ context = PredefinedVariables.CI_PROJECT_DIR
121+
119122 if context:
120123 if context.endswith("/"):
121124 context = context[:-1]
@@ -130,6 +133,9 @@ <h1 class="title">Module <code>gcip.addons.kaniko.jobs</code></h1>
130133 if verbosity:
131134 executor_cmd.append(f"--verbosity {verbosity}")
132135
136+ if not dockerfile and PredefinedVariables.CI_PROJECT_DIR:
137+ dockerfile = f"{PredefinedVariables.CI_PROJECT_DIR}/Dockerfile"
138+
133139 if dockerfile:
134140 executor_cmd.append(f"--dockerfile {dockerfile}")
135141
@@ -163,11 +169,9 @@ <h1 class="title">Module <code>gcip.addons.kaniko.jobs</code></h1>
163169 job.prepend_scripts('mkdir -p /kaniko/.docker && echo "{\\"credsStore\\":\\"ecr-login\\"}" > /kaniko/.docker/config.json')
164170
165171 if dockerhub_user_env_var and dockerhub_login_env_var:
166- # auth=$(echo "$DOCKER_USER:$DOCKER_LOGIN" | base64)
167- auth = f'$(echo "${dockerhub_user_env_var}:${dockerhub_login_env_var}" | base64)'
168172 job.prepend_scripts(
169- 'mkdir -p /kaniko/.docker && echo "{\\"auths\\":{\\"https://index.docker.io/v1/\\":{\\"auth \\":\\"' + auth +
170- '\\"}}}" > /kaniko/.docker/config.json'
173+ 'mkdir -p /kaniko/.docker && echo "{\\"auths\\":{\\"https://index.docker.io/v1/\\":{\\"username \\":\\"$ ' +
174+ dockerhub_user_env_var + '\\",\\"password\\":\\"$' + dockerhub_login_env_var + '\\"}}}" > /kaniko/.docker/config.json'
171175 )
172176
173177 job.append_scripts(" ".join(executor_cmd), "rm -rf /kaniko/.docker/config.json")
@@ -249,7 +253,7 @@ <h2 id="returns">Returns</h2>
249253< span > Expand source code</ span >
250254</ summary >
251255< pre > < code class ="python "> def execute(
252- gitlab_executor_image: Optional[Union[Image, str]] = Image("gcr.io/kaniko-project/executor:latest ", entrypoint=[""]),
256+ gitlab_executor_image: Optional[Union[Image, str]] = Image("gcr.io/kaniko-project/executor:debug ", entrypoint=[""]),
253257 context: Optional[str] = None,
254258 image_name: Optional[str] = None,
255259 image_tag: Optional[str] = None,
@@ -325,6 +329,9 @@ <h2 id="returns">Returns</h2>
325329
326330 executor_cmd: List[str] = ["executor"]
327331
332+ if not context and PredefinedVariables.CI_PROJECT_DIR:
333+ context = PredefinedVariables.CI_PROJECT_DIR
334+
328335 if context:
329336 if context.endswith("/"):
330337 context = context[:-1]
@@ -339,6 +346,9 @@ <h2 id="returns">Returns</h2>
339346 if verbosity:
340347 executor_cmd.append(f"--verbosity {verbosity}")
341348
349+ if not dockerfile and PredefinedVariables.CI_PROJECT_DIR:
350+ dockerfile = f"{PredefinedVariables.CI_PROJECT_DIR}/Dockerfile"
351+
342352 if dockerfile:
343353 executor_cmd.append(f"--dockerfile {dockerfile}")
344354
@@ -372,11 +382,9 @@ <h2 id="returns">Returns</h2>
372382 job.prepend_scripts('mkdir -p /kaniko/.docker && echo "{\\"credsStore\\":\\"ecr-login\\"}" > /kaniko/.docker/config.json')
373383
374384 if dockerhub_user_env_var and dockerhub_login_env_var:
375- # auth=$(echo "$DOCKER_USER:$DOCKER_LOGIN" | base64)
376- auth = f'$(echo "${dockerhub_user_env_var}:${dockerhub_login_env_var}" | base64)'
377385 job.prepend_scripts(
378- 'mkdir -p /kaniko/.docker && echo "{\\"auths\\":{\\"https://index.docker.io/v1/\\":{\\"auth \\":\\"' + auth +
379- '\\"}}}" > /kaniko/.docker/config.json'
386+ 'mkdir -p /kaniko/.docker && echo "{\\"auths\\":{\\"https://index.docker.io/v1/\\":{\\"username \\":\\"$ ' +
387+ dockerhub_user_env_var + '\\",\\"password\\":\\"$' + dockerhub_login_env_var + '\\"}}}" > /kaniko/.docker/config.json'
380388 )
381389
382390 job.append_scripts(" ".join(executor_cmd), "rm -rf /kaniko/.docker/config.json")
0 commit comments