<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>CI/CD on totoroot's blog</title><link>https://blog.thym.at/tags/ci/cd/</link><description>Recent content in CI/CD on totoroot's blog</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Tue, 03 Mar 2026 17:17:10 +0100</lastBuildDate><atom:link href="https://blog.thym.at/tags/ci/cd/index.xml" rel="self" type="application/rss+xml"/><item><title>Masked GitLab CI variables need at least 8 characters</title><link>https://blog.thym.at/p/gitlab-masked-vars-min-length/</link><pubDate>Tue, 03 Mar 2026 17:17:10 +0100</pubDate><guid>https://blog.thym.at/p/gitlab-masked-vars-min-length/</guid><description>&lt;h1 id="masked-gitlab-ci-variables-need-at-least-8-characters"&gt;Masked GitLab CI variables need at least 8 characters
&lt;/h1&gt;&lt;p&gt;Today I ran into a small GitLab CI gotcha.&lt;/p&gt;
&lt;p&gt;I wanted to store an SSH port as a &lt;strong&gt;masked&lt;/strong&gt; CI/CD variable, but GitLab rejected it because masked values must satisfy stricter validation rules (including minimum length).&lt;/p&gt;
&lt;p&gt;A short numeric port value can fail that check.&lt;/p&gt;
&lt;p&gt;Related discussion: &lt;a class="link" href="https://gitlab.com/gitlab-org/gitlab/-/work_items/465258" target="_blank" rel="noopener"
&gt;https://gitlab.com/gitlab-org/gitlab/-/work_items/465258&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="workaround"&gt;Workaround
&lt;/h2&gt;&lt;p&gt;Store a padded masked variable, then normalize it in CI.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;DEPLOY_PORT_MASKED=00023456&lt;/code&gt; (masked, 8 chars)&lt;/li&gt;
&lt;li&gt;Convert it back to an integer in the job:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;DEPLOY_PORT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="k"&gt;$((&lt;/span&gt;&lt;span class="m"&gt;10#&lt;/span&gt;&lt;span class="nv"&gt;$DEPLOY_PORT_MASKED&lt;/span&gt;&lt;span class="k"&gt;))&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; DEPLOY_PORT
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then use &lt;code&gt;DEPLOY_PORT&lt;/code&gt; normally:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ssh -p &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$DEPLOY_PORT&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt; ...
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="why-10-matters"&gt;Why &lt;code&gt;10#&lt;/code&gt; matters
&lt;/h2&gt;&lt;p&gt;&lt;code&gt;10#&lt;/code&gt; forces base-10 parsing and safely strips leading zeros.
Without it, shell arithmetic can misinterpret leading-zero numbers in some cases.&lt;/p&gt;
&lt;h2 id="result"&gt;Result
&lt;/h2&gt;&lt;p&gt;I can keep the value masked in GitLab and still use the intended port at runtime.&lt;/p&gt;</description></item></channel></rss>