{"id":401,"date":"2023-11-05T21:34:30","date_gmt":"2023-11-05T21:34:30","guid":{"rendered":"https:\/\/devopsopen.com\/?p=401"},"modified":"2023-11-05T23:08:22","modified_gmt":"2023-11-05T23:08:22","slug":"create-registry-credential-for-gitlabci","status":"publish","type":"post","link":"https:\/\/devopsopen.com\/index.php\/2023\/11\/05\/create-registry-credential-for-gitlabci\/","title":{"rendered":"Create Registry Credential for GitLabCI"},"content":{"rendered":"<h2>Create Secret<\/h2>\n<ul>\n<li>Get information :<\/li>\n<\/ul>\n<p>username : the name of your deploy token<br \/>\npassword : the value of token<br \/>\nemail: your email<br \/>\nauth : base 64 username:password  <\/p>\n<p>you can generate auth with this command <\/p>\n<pre><code>echo &quot;patoken:npAdzEy79ybtQdfdf&quot; | base64\nResult :  gHy5cm9sbGZyb250ZW5kdG9rZW46bnBBZHpFeTc5eWJ0UWtoaEtUaG0Y<\/code><\/pre>\n<ul>\n<li>Create a yaml file 'registry-front-credentials.yml' with your informations <\/li>\n<\/ul>\n<pre><code>{\n    &quot;auths&quot;: {\n        &quot;https:\/\/registry.gitlab.com&quot;:{\n            &quot;username&quot;:&quot;patoken&quot;,\n            &quot;password&quot;:&quot;npAdYiy79ybtQdfdf&quot;,\n            &quot;email&quot;:&quot;your@gmail.com&quot;,\n            &quot;auth&quot;:&quot;gHy5cm9sbGZyb250ZW5kdG9rZW46bnBBZHpFeTc5eWJ0UWtoaEtUaG0Y&quot;\n        }\n    }\n}<\/code><\/pre>\n<ul>\n<li>Encode with base64 the file above with this command <\/li>\n<\/ul>\n<pre><code>base64 registry-front-credentials.yml &gt; output.txt\nResult :  vi output.txt\nrwogICAgImF1dGhzIjogewogYCAgICAgICJodHRwczovL3JlZ2lzdHJ5LmdpdGxhYi5jb20iOnsK\nICAgICAgICAgICAgInVzZXJuYW1lIjoicGF5cm9sbGZyb250ZW5kdG9rZW4iLAogICAgICAgICAg\nICAicGFzc3dvcmQiOiJucEFlekV5Nzl5YnRRa2hoS1RobSIsCiAgICAgICAgICAgICJlbWFpbCI6\nInZpeGF3ZWJAZ21haWwuY29tIiwKICAgICAgICAgICAgImF1dGgiOiJjR0Y1Y205c2JHWnliMjUw\nWlc1a2RHOXJaVzQ2Ym5CQlpIcEZlVGM1ZVdKMFVXdG9hRXRVYUcwSyIKICAgICAgICB9CiAgICB9\nGuYt<\/code><\/pre>\n<ul>\n<li>Create the secret with Yaml file. Be attention the token in dockerconfigjson should be in one line<\/li>\n<\/ul>\n<pre><code>apiVersion: v1\nkind: Secret\nmetadata:\n  name: registryfront-credentials\ntype: kubernetes.io\/dockerconfigjson\ndata:\n  .dockerconfigjson: rwogICAgImF1dGhzIjogewogYCAgICAgICJodHRwczovL3JlZ2lzdHJ5LmdpdGxhYi5jb20iOnsK\nICAgICAgICAgICAgInVzZXJuYW1lIjoicGF5cm9sbGZyb250ZW5kdG9rZW4iLAogICAgICAgICAg\nICAicGFzc3dvcmQiOiJucEFlekV5Nzl5YnRRa2hoS1RobSIsCiAgICAgICAgICAgICJlbWFpbCI6\nInZpeGF3ZWJAZ21haWwuY29tIiwKICAgICAgICAgICAgImF1dGgiOiJjR0Y1Y205c2JHWnliMjUw\nWlc1a2RHOXJaVzQ2Ym5CQlpIcEZlVGM1ZVdKMFVXdG9hRXRVYUcwSyIKICAgICAgICB9CiAgICB9\nGuYt<\/code><\/pre>\n<ul>\n<li>In your deploy file add the secret<\/li>\n<\/ul>\n<pre><code>apiVersion: apps\/v1\nkind: Deployment\nmetadata:\n  name: payrollfrontend-deployment\n  labels:\n    app: payrollfrontend-deployment\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: payrollfrontend-deployment\n  template:\n    metadata:\n      labels:\n        app: payrollfrontend-deployment\n    spec:\n      containers:\n        - name: payrollfrontend-deployment\n          image: registry.gitlab.com\/payrollgroup\/payrollfrontend:main\n      imagePullSecrets:\n        - name: registryfront-credentials<\/code><\/pre>\n<ul>\n<li>To see the secret<\/li>\n<\/ul>\n<pre><code>kubectl get secret registr-credentials -o jsonpath=&#039;{.data}&#039;\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Create Secret Get information : username : the name of your deploy token password : the value of token email: your email auth : base 64 username:password you can generate auth with this command echo &quot;patoken:npAdzEy79ybtQdfdf&quot; | base64 Result : gHy5cm9sbGZyb250ZW5kdG9rZW46bnBBZHpFeTc5eWJ0UWtoaEtUaG0Y Create a yaml file &#8216;registry-front-credentials.yml&#8217; with your informations { &quot;auths&quot;: { &quot;https:\/\/registry.gitlab.com&quot;:{ &quot;username&quot;:&quot;patoken&quot;, &quot;password&quot;:&quot;npAdYiy79ybtQdfdf&quot;, &quot;email&quot;:&quot;your@gmail.com&quot;, &quot;auth&quot;:&quot;gHy5cm9sbGZyb250ZW5kdG9rZW46bnBBZHpFeTc5eWJ0UWtoaEtUaG0Y&quot; } } } Encode with base64 the file above with this command base64 registry-front-credentials.yml &gt; output.txt Result : vi output.txt rwogICAgImF1dGhzIjogewogYCAgICAgICJodHRwczovL3JlZ2lzdHJ5LmdpdGxhYi5jb20iOnsK ICAgICAgICAgICAgInVzZXJuYW1lIjoicGF5cm9sbGZyb250ZW5kdG9rZW4iLAogICAgICAgICAg ICAicGFzc3dvcmQiOiJucEFlekV5Nzl5YnRRa2hoS1RobSIsCiAgICAgICAgICAgICJlbWFpbCI6 InZpeGF3ZWJAZ21haWwuY29tIiwKICAgICAgICAgICAgImF1dGgiOiJjR0Y1Y205c2JHWnliMjUw Wlc1a2RHOXJaVzQ2Ym5CQlpIcEZlVGM1ZVdKMFVXdG9hRXRVYUcwSyIKICAgICAgICB9CiAgICB9 GuYt Create the secret with Yaml file. Be attention the token in dockerconfigjson should be in one line\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":""},"categories":[10],"tags":[],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":5}},"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"admin","author_link":"https:\/\/devopsopen.com\/index.php\/author\/admin_bak\/"},"uagb_comment_info":31,"uagb_excerpt":"Create Secret Get information : username : the name of your deploy token password : the value of token email: your email auth : base 64 username:password you can generate auth with this command echo &quot;patoken:npAdzEy79ybtQdfdf&quot; | base64 Result : gHy5cm9sbGZyb250ZW5kdG9rZW46bnBBZHpFeTc5eWJ0UWtoaEtUaG0Y Create a yaml file 'registry-front-credentials.yml' with your informations { &quot;auths&quot;: { &quot;https:\/\/registry.gitlab.com&quot;:{ &quot;username&quot;:&quot;patoken&quot;, &quot;password&quot;:&quot;npAdYiy79ybtQdfdf&quot;,&hellip;","_links":{"self":[{"href":"https:\/\/devopsopen.com\/index.php\/wp-json\/wp\/v2\/posts\/401"}],"collection":[{"href":"https:\/\/devopsopen.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devopsopen.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devopsopen.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/devopsopen.com\/index.php\/wp-json\/wp\/v2\/comments?post=401"}],"version-history":[{"count":5,"href":"https:\/\/devopsopen.com\/index.php\/wp-json\/wp\/v2\/posts\/401\/revisions"}],"predecessor-version":[{"id":406,"href":"https:\/\/devopsopen.com\/index.php\/wp-json\/wp\/v2\/posts\/401\/revisions\/406"}],"wp:attachment":[{"href":"https:\/\/devopsopen.com\/index.php\/wp-json\/wp\/v2\/media?parent=401"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devopsopen.com\/index.php\/wp-json\/wp\/v2\/categories?post=401"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devopsopen.com\/index.php\/wp-json\/wp\/v2\/tags?post=401"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}