{"id":838,"date":"2025-05-06T15:22:36","date_gmt":"2025-05-06T19:22:36","guid":{"rendered":"https:\/\/waterloobae.com\/?p=838"},"modified":"2025-08-15T21:51:21","modified_gmt":"2025-08-16T01:51:21","slug":"gitlab-runner-preparing-environment-error-job-failed-prepare-environment-exit-status-1","status":"publish","type":"post","link":"https:\/\/waterloobae.com\/blog\/2025\/05\/06\/gitlab-runner-preparing-environment-error-job-failed-prepare-environment-exit-status-1\/","title":{"rendered":"Gitlab Runner: Preparing environment Error: Job failed: prepare environment: exit status 1."},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">When your Gitlab runner fails with even simple script, I hope this helps. I have this simple script to run in gitlab-ci.yml <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"yaml\" class=\"language-yaml\">qa_test:\n  stage: qa\n  tags: \n    - psg-dev\n  script:\n    - echo \"Running QA tests\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">However, it fails as below even any other settings for config.toml looks okay.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"266\" src=\"https:\/\/waterloobae.com\/wp-content\/uploads\/2025\/05\/image-1024x266.png\" alt=\"\" class=\"wp-image-839\" srcset=\"https:\/\/waterloobae.com\/wp-content\/uploads\/2025\/05\/image-1024x266.png 1024w, https:\/\/waterloobae.com\/wp-content\/uploads\/2025\/05\/image-300x78.png 300w, https:\/\/waterloobae.com\/wp-content\/uploads\/2025\/05\/image-768x199.png 768w, https:\/\/waterloobae.com\/wp-content\/uploads\/2025\/05\/image.png 1203w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If so, you can modify shell logout file or delete it. It can be found in gitlab runner home directory. It is usually <em><code>\/home\/gitlab-runner\/<\/code><\/em>. For bash shell, it is .bashrc_logout. You can comment out all lines and save it or you can just remove .bashrc_logout file in gitlab runner home directory. Then, it will work magically. Hope this helps.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When your Gitlab runner fails with even simple script, I hope this helps. I have this simple script to run in gitlab-ci.yml However, it fails as below even any other settings for config.toml looks okay. If so, you can modify shell logout file or delete it. It can be found in gitlab runner home directory. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,4],"tags":[],"class_list":["post-838","post","type-post","status-publish","format-standard","hentry","category-git","category-it-tips"],"_links":{"self":[{"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/posts\/838","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/comments?post=838"}],"version-history":[{"count":5,"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/posts\/838\/revisions"}],"predecessor-version":[{"id":977,"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/posts\/838\/revisions\/977"}],"wp:attachment":[{"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/media?parent=838"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/categories?post=838"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/tags?post=838"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}