<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: cambiph</title>
    <description>The latest articles on DEV Community by cambiph (@cambiph).</description>
    <link>https://dev.to/cambiph</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F173997%2F6f83d23a-ca81-4310-83a1-3bf2ac5c492e.jpeg</url>
      <title>DEV Community: cambiph</title>
      <link>https://dev.to/cambiph</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cambiph"/>
    <language>en</language>
    <item>
      <title>NPM run scripts exit status in Docker</title>
      <dc:creator>cambiph</dc:creator>
      <pubDate>Mon, 07 Oct 2019 08:35:21 +0000</pubDate>
      <link>https://dev.to/cambiph/npm-run-scripts-exit-status-in-docker-2m34</link>
      <guid>https://dev.to/cambiph/npm-run-scripts-exit-status-in-docker-2m34</guid>
      <description>&lt;p&gt;Hello all,&lt;/p&gt;

&lt;p&gt;I am confused to how the exit code from a process inside a container gets passed to docker.&lt;br&gt;
I have a container which runs an npm run script.&lt;br&gt;
The npm run script fails with exit status 1 but it seems that the exit status is not passed to the docker process itself because Bamboo flags the build task as success.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;30-Sep-2019 15:43:53    npm ERR! Exit status 1
30-Sep-2019 15:43:53    npm ERR!
30-Sep-2019 15:43:53    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
30-Sep-2019 15:43:53    
30-Sep-2019 15:43:53    npm ERR! A complete log of this run can be found in:
30-Sep-2019 15:43:53    npm ERR!     /root/.npm/_logs/2019-09-30T13_43_53_321Z-debug.log
30-Sep-2019 15:43:54    Stopping containers 
30-Sep-2019 15:43:54    b3efbe0710cc
30-Sep-2019 15:43:54    Removing containers
30-Sep-2019 15:43:55    b3efbe0710cc
30-Sep-2019 15:43:55    Finished task 'Script' with result: Success
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The container is started with the docker run command.&lt;/p&gt;

&lt;p&gt;Any advice?&lt;br&gt;
Thanks in advance.&lt;br&gt;
Regards&lt;/p&gt;

</description>
      <category>help</category>
    </item>
    <item>
      <title>Setting up an SSH-tunnel using plink</title>
      <dc:creator>cambiph</dc:creator>
      <pubDate>Mon, 01 Jul 2019 07:55:39 +0000</pubDate>
      <link>https://dev.to/cambiph/setting-up-an-ssh-tunnel-using-plink-4om7</link>
      <guid>https://dev.to/cambiph/setting-up-an-ssh-tunnel-using-plink-4om7</guid>
      <description>&lt;p&gt;At our company, we can only connect to the outside world using the standard ports. Outgoing traffic to port 8081 is blocked by the firewall. This is a real pain in the ass. We need to publish our Javascript libraries to a Nexus instance. This instance is running in the cloud on, you guessed it, port 8081.&lt;/p&gt;

&lt;p&gt;We are already using Jenkins pipelines to automate our workflow. The decision was made to add a new step to the pipeline: ssh-tunneling. Our Jenkins instance is running in Windows Server 2012 R2. Using bash to create a tunnel cannot be achieved. We took a look at Powershell to set up the SSH tunnel but it seems thatthe implementation of SSH in Powershell is not mature enough. Batch scripts to the rescue!&lt;/p&gt;

&lt;p&gt;Most of us are using Putty to handle our SSH-sessions. The people who make Putty also make plink, a command-line interface to the Putty back-end. In combination with batch files we can create an SSH-tunnel like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;plink &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="nt"&gt;-x&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt; &lt;span class="nt"&gt;-T&lt;/span&gt; &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="nt"&gt;-noagent&lt;/span&gt; &lt;span class="nt"&gt;-ssh&lt;/span&gt; &lt;span class="nt"&gt;-pw&lt;/span&gt; “password” &lt;span class="nt"&gt;-L&lt;/span&gt; 8081:our-nexus-instance.com:8081 username@our-nexus-instance.com
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Let me explain the different flags used in the command above:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-v : show verbose messages
-x: enable X11 forwarding
-a: enable agent forwarding
-T: disable pty allocation
-C: enable compression
-noagent: disable use of Pageant (only needed when using SSH-keys)
-ssh: use the SSH-protocol
-pw: provide the password
-L: forward local port to remote address
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Using the -L flag we can map a local port to a remote port. This is done using the following syntax: ::. This is followed by the hostname we want to connect to, prefixed with the username, used to connect: username@remoteHost.&lt;/p&gt;

&lt;p&gt;By inserting this command into our Jenkinsfile, we can open a tunnel to our remote Nexus instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;stage&lt;span class="o"&gt;(&lt;/span&gt;‘Publish’&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
 steps &lt;span class="o"&gt;{&lt;/span&gt;
  bat “plink &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="nt"&gt;-x&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt; &lt;span class="nt"&gt;-T&lt;/span&gt; &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="nt"&gt;-noagent&lt;/span&gt; &lt;span class="nt"&gt;-ssh&lt;/span&gt; &lt;span class="nt"&gt;-pw&lt;/span&gt; ‘password &lt;span class="nt"&gt;-L&lt;/span&gt; 8081:our-  
       nexus-instance:8081 username@our-nexus-instance.com”
   &lt;span class="o"&gt;}&lt;/span&gt;
 &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



</description>
      <category>ssh</category>
    </item>
    <item>
      <title>Working with private repos in Docker</title>
      <dc:creator>cambiph</dc:creator>
      <pubDate>Fri, 31 May 2019 09:39:45 +0000</pubDate>
      <link>https://dev.to/cambiph/working-with-private-repos-in-docker-5fj2</link>
      <guid>https://dev.to/cambiph/working-with-private-repos-in-docker-5fj2</guid>
      <description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;I am trying to work out an elegant way to build Node apps in Docker containers which use a private repo for its dependencies (JFrog artifactory) and a private Github repo.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Artifactory&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I could just copy in my .npmrc but I am quite hessitant because it contains my authentication key.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Github repo&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I could copy in my SSH-key but that seems like a big security risk.&lt;/p&gt;

&lt;p&gt;What are your thoughts on this?&lt;br&gt;
Thanks in advance!&lt;br&gt;
Cheers&lt;/p&gt;

</description>
      <category>help</category>
    </item>
  </channel>
</rss>
