<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
    <title>La Forge - crates sur Gitlab</title>
    <subtitle>Le blog de la Forge</subtitle>
    <link rel="self" type="application/atom+xml" href="https://staging.lafor.ge/tags/crates-sur-gitlab/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://staging.lafor.ge"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2024-04-24T00:00:00+00:00</updated>
    <id>https://staging.lafor.ge/tags/crates-sur-gitlab/atom.xml</id>
    <entry xml:lang="fr">
        <title>Partie 3: Gestion des workspaces</title>
        <published>2024-04-24T00:00:00+00:00</published>
        <updated>2024-04-24T00:00:00+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://staging.lafor.ge/crates-3/"/>
        <id>https://staging.lafor.ge/crates-3/</id>
        
        <content type="html" xml:base="https://staging.lafor.ge/crates-3/">&lt;details &gt;
	&lt;summary&gt;&lt;span&gt;Les articles de la série&lt;/span&gt;&lt;/summary&gt;
	&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;/crates-1&quot;&gt;Partie 1&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;/crates-2&quot;&gt;Partie 2&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;/details&gt;
&lt;p&gt;Bonjour à toutes et à tous 😀&lt;/p&gt;
&lt;p&gt;Dans le &lt;a href=&quot;/crates-2&quot;&gt;précédent&lt;/a&gt; article, nous avons créé un pipeline de création de package à la fois de release et de pre-release pour un projet mono-crate.&lt;/p&gt;
&lt;p&gt;Mais en Rust, il existe un mécanisme très utilisés qui se nomme les &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://doc.rust-lang.org/book/ch14-03-cargo-workspaces.html&quot;&gt;workspaces&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Ce sont des environnement de crates liées qui permettent de découper un projet lorsqu’il devient trop volumnineux ou lorsque le besoin de partager des données se fait sentir.&lt;/p&gt;
&lt;h2 id=&quot;workspace&quot;&gt;Workspace&lt;/h2&gt;
&lt;p&gt;Pour créer un workspace, on peut taper.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;echo&lt;/span&gt;&lt;span&gt; [workspace&lt;/span&gt;&lt;span&gt;] &lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;  Cargo.toml&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;cargo&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; new&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-lib&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; w1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Une ligne va venir se rajouter dans le Cargo.toml&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Cargo.toml&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;toml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;workspace&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;members&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;w1&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Et on peut rajouter autant de sous crates que l’on veut&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;cargo&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; new&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-lib&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; w2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;cargo&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; new&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-lib&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; w3&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Si l’on tente de faire&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;cargo&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; package&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-allow-dirty&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Il va le faire pour &lt;code&gt;w1&lt;/code&gt;, &lt;code&gt;w2&lt;/code&gt; et &lt;code&gt;w3&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;C’est en soit cool, mais pas très intéressant pour nous.&lt;/p&gt;
&lt;p&gt;Généralement les crates d’un workspace ont des cycles de versions disjoint, autrement dit ce n’est pas parce que &lt;code&gt;w1&lt;/code&gt; change de version que c’est le cas de &lt;code&gt;w2&lt;/code&gt; et de &lt;code&gt;w2&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Heureusement il est possible de scoper le package à créer&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;cargo&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; package&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; w1&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-allow-dirty&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Parfait et maintenant les métadonnées.&lt;/p&gt;
&lt;p&gt;Il est nécessaire au bon fonctionnement de la registry et ce n’est pas grave en soit que le workspace complet y soit décrit.&lt;/p&gt;
&lt;p&gt;On vient juste s’assurer que les dépendences ne soient pas prise en compte avec&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;cargo&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; metadata&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-format-version&lt;/span&gt;&lt;span class=&quot;z-l-9 z-d-14&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-no-deps&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; &amp;gt;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; metadata.json&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On va donc utiliser une variable &lt;code&gt;CRATE_PACKAGE&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ariables&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Qui va venir contrôler le package à créer.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;cargo&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; package&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_PACKAGE&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-allow-dirty&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ok, et donc on contrôle comment cette variable ?&lt;/p&gt;
&lt;p&gt;Alors on peut le faire depuis les variables de CI externes, mais ce n’est pas pratique.&lt;/p&gt;
&lt;p&gt;Au lieu de ça, je vous propose d’utiliser ce que l’on appelle les &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://docs.gitlab.com/ee/ci/yaml/#needsparallelmatrix&quot;&gt;matrix&lt;/a&gt;, cela permet de faire tourner en parrallèle plusieurs jobs d’un même type mais configuré différemment.&lt;/p&gt;
&lt;p&gt;Première étape on invisibilise la tâche de &lt;code&gt;release-prod&lt;/code&gt; en la suffixant d’un point &lt;code&gt;.release-prod&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;release-prod&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  i&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;mage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; r&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ust:1.77&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; seulement si c&amp;#39;est main&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  o&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;nly&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ain&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;cript&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;prepare&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;packaging&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Puis on utilise la &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://docs.gitlab.com/ee/ci/yaml/#extends&quot;&gt;composition&lt;/a&gt; et matrix.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;elease-prod&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  e&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;xtends&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; .&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;release-prod&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  w&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;hen&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;anual&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  p&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;arallel&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;    m&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;atrix&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      -&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; w&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      -&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; w&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      -&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; w&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;3&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Nous avons maintenant un pipeline qui permet de créer de manière indépendante des versions de releases.&lt;/p&gt;
&lt;h2 id=&quot;recuperer-la-version&quot;&gt;Récupérer la version&lt;/h2&gt;
&lt;p&gt;Mais il reste une question en suspend.&lt;/p&gt;
&lt;p&gt;Comment récupérer le nom et la version du package ciblé, pour le nom on l’a déjà mais nous allons tout de même le reconstruire pour être certain.&lt;/p&gt;
&lt;p&gt;Pour faire cela, nous allons utiliser la commande &lt;code&gt;cargo metadata&lt;/code&gt; pour lister les packages existants:&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;cargo&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; metadata&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-format-version&lt;/span&gt;&lt;span class=&quot;z-l-9 z-d-14&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-no-deps&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt; jq&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Nous obtenons ce json pour un workspace&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;  &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;packages&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; :&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; :&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;w1&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; :&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;0.1.0&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;manifest_path&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; :&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/path/to/workspace/w1/Cargo.toml&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; :&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;w2&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; :&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;0.1.0&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;manifest_path&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; :&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/path/to/workspace/w2/Cargo.toml&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; :&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;w3&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; :&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;0.1.0&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;manifest_path&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; :&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/path/to/workspace/w3/Cargo.toml&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  //&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Et celui-ci pour un projet “simple”&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;  &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;packages&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; :&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; :&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;subber&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; :&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;0.1.0&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;manifest_path&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; :&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/path/to/subber/Cargo.toml&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  //&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Nous avons donc 2 cas à traiter:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Le premier on cherche à récupérer la version d’un package explicitement nommé par la variable &lt;code&gt;$CRATE_PACKAGE&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Le second est le cas implicite d’un état à un package et l’absence de variable &lt;code&gt;$CRATE_PACKAGE&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Comment procède-t-on ?&lt;/p&gt;
&lt;p&gt;Et bien jq est bien plus qu’il ne semble être.&lt;/p&gt;
&lt;p&gt;Il est par exemple possible de créer des &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://jqlang.github.io/jq/manual/#if-then-else-end&quot;&gt;conditions&lt;/a&gt; qui vont venir créer des branches d’exécutions.&lt;/p&gt;
&lt;p&gt;Notre algorithm va être:&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SI la &amp;quot;taille du tableau de package&amp;quot; est supérieur à 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ALORS&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  SELECTIONNER le package qui possède le nom == $CRATE_PACKAGE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SINON&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  SELECTIONNER le premier package&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;END&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;En jq cela nous donne&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if (.packages | length ) &amp;gt; 1 &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;then &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(.packages[] | select(.name == $PACKAGE)) &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;else &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.packages[0] &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Puis nous pouvons récupérer ce qui nous intéresse&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&amp;quot;name&amp;quot; : .name, &amp;quot;version&amp;quot;: .version, &amp;quot;manifest&amp;quot;: .manifest_path}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On export le résultat dans une variable &lt;code&gt;$PACKAGE_DATA&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; PACKAGE_DATA&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;=&lt;/span&gt;&lt;span&gt;$(&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;cargo&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; metadata&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-format-version&lt;/span&gt;&lt;span class=&quot;z-l-9 z-d-14&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-no-deps&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt; jq&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-arg&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; PACKAGE&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_PACKAGE&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;(if (.packages | length ) &amp;gt; 1 then (.packages[] | select(.name == $PACKAGE)) else .packages[0] end) | {&amp;quot;name&amp;quot; : .name, &amp;quot;version&amp;quot;: .version, &amp;quot;manifest&amp;quot;: .manifest_path}&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ensuite, nous mettons en place un garde-fou, qui a deux rôle:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;vérifier que au moins un package existe dans le workspace&lt;/li&gt;
&lt;li&gt;vérifier que le package sélectionné existe&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Pour cela on vérifie que la variable n’est pas vide sinon on quitte&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[ -z &amp;quot;$PACKAGE_DATA&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;Unknown package $PACKAGE in workspace&amp;quot; &amp;amp;&amp;amp; exit 1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ensuite, on récupère tranquillement:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;la version&lt;/li&gt;
&lt;li&gt;le Cargo.toml du package&lt;/li&gt;
&lt;li&gt;le nom du package&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; CRATE_NAME&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;=&lt;/span&gt;&lt;span&gt;$(&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;jq&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.name&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; &amp;lt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;PACKAGE_DATA&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt; tr&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; CRATE_VERSION&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;=&lt;/span&gt;&lt;span&gt;$(&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;jq&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.version&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; &amp;lt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;PACKAGE_DATA&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt; tr&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; CARGO_FILE&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;=&lt;/span&gt;&lt;span&gt;$(&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;jq&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.manifest&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; &amp;lt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;PACKAGE_DATA&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt; tr&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;dependances-transitives&quot;&gt;Dépendances transitives&lt;/h2&gt;
&lt;p&gt;Mais il y a un autre souci, un de plus 😝&lt;/p&gt;
&lt;p&gt;Pour créer les versions flottantes, nous modifions le &lt;code&gt;Cargo.toml&lt;/code&gt; du package voulu&lt;/p&gt;
&lt;p&gt;Mais ça cargo n’aime pas du tout, si dans ses dépendences il y a&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;w2/Cargo.toml&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;toml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;package&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;name&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;w2&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;dependencies&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;w1&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;path&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;../w1&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; version&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;0.2.0&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; registry&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;private-crates&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Et que l’on s’amuse à transformer la version du package &lt;code&gt;w1&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;w2/Cargo.toml&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;toml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;package&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;name&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;w1&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;version&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;0.2.0-124eba69&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Cargo va pas être content car il ne s’attend pas à cette version et n’a plus de repère pour créer le package&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if you are looking for the prerelease package it needs to be specified explicitly&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    w1 = { version = &amp;quot;0.2.0-124eba69&amp;quot; }&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Il faut donc aller trafiquer le Cargo.toml de &lt;code&gt;w2&lt;/code&gt; pour lui donner la bonne version.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;w2/Cargo.toml&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;toml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;package&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;name&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;w2&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;dependencies&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; dynamiquement modifié&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;w1&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;path&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;../w1&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; version&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;0.2.0-124eba69&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; registry&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;private-crates&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Et ce, pour toutes les packages utilisant &lt;code&gt;w1&lt;/code&gt; dans le workspace.&lt;/p&gt;
&lt;p&gt;Ok, on fait ça comment ?&lt;/p&gt;
&lt;p&gt;La manière la plus “simple” est de lister les ‘Cargo.toml’&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;cargo&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; metadata&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-format-version&lt;/span&gt;&lt;span class=&quot;z-l-9 z-d-14&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-no-deps&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt; jq&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.packages[] | .manifest_path | tostring&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;En suite on liste en suite les dépendences qui possède &lt;code&gt;w1&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;tomlq&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.dependencies&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; w2/Cargo.toml&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt; jq&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; .&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;w1&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Renvera&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;  &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;../w1&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;  &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;0.1.0-toto&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Par contre&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;tomlq&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.dependencies&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; w1/Cargo.toml&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt; jq&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; .&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;w1&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Renvera&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-9 z-d-14&quot;&gt;null&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Il est ainsi possible de fail fast sur les Cargo.toml qui ne nous intéressent pas.&lt;/p&gt;
&lt;p&gt;Ensuite il suffit de réaliser le remplacement dans le toml&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;tomlq&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.dependencies.w1.version = &amp;quot;0.2.0-124eba69&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; w2/Cargo.toml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ce serait si simple si cela marchait aussi facilement mais il y a un soucis&lt;/p&gt;
&lt;p&gt;Lorque que l’on tente de variabiliser&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;tomlq&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-arg&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; PAKAGE&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; w1&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.dependencies.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;PACKAGE&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.version = &lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;0.2.0-124eba69&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; w2/Cargo.toml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On arrive sur cette erreur&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jq: error: syntax error, unexpected &amp;#39;$&amp;#39;, expecting FORMAT or QQSTRING_START (Unix shell quoting issues?) at &amp;lt;top-level&amp;gt;, line 1:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.dependencies.$PACKAGE.version = &amp;quot;0.2.0-124eba69&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;La solution de déport que j’ai trouvé est de templatiser l’expression à coup de bash expansion&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;FILE&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;C&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;g&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;o&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;o&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;l&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;PACKAGE&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;VERSION&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;9&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;COMMAND&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;=&lt;/span&gt;&lt;span&gt;$(&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;tomlq&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.dependencies.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;PACKAGE&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.version = &lt;/span&gt;&lt;span class=&quot;z-l-9 z-d-14&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;VERSION&lt;/span&gt;&lt;span class=&quot;z-l-9 z-d-14&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;FILE&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;COMMAND&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Et cette fois-ci c’est fonctionnel !&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;toml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;package&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;name&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;w2&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;dependencies&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;w1&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;path&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;../w1&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; version&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;0.2.0-124eba69&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; registry&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;private-crates&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On se rapproche, maintenant, nous voulons appliquer cette modification à tous les sous package.&lt;/p&gt;
&lt;p&gt;Nous sommes capable de les lister, plus qu’à appliquer.&lt;/p&gt;
&lt;p&gt;Et pour ça il nous faut un autre outil qui se nomme &lt;code&gt;xargs&lt;/code&gt;, c’est une usine à gaz, donc je ne vais pas rentrer dans les détails mais l’idée ici c’est
qu’il va prendre les résultat ligne par ligne et les appliquer à des traitements.&lt;/p&gt;
&lt;p&gt;Par exemple&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; cat&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; toto&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;titi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;tata&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;tutu&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; cat&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; toto&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt; xargs&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;I&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; {}&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; echo&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; {}+suffix&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Cela affichera&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;titi+suffix&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tata+suffix&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tutu+suffix&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;blockquote class=&quot;markdown-alert-warning&quot;&gt;
	&lt;p&gt;Si vous êtes sur windows wsl, attention a bien créer le fichier sans &lt;code&gt;CRLF&lt;/code&gt;, xargs ne prend en compte que le &lt;code&gt;LF&lt;/code&gt; et traite le &lt;code&gt;CR&lt;/code&gt; comme un caractère indifférent.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;On vient créer un script à coup de heredoc&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;cat&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; &amp;lt;&amp;lt;&lt;/span&gt;&lt;span&gt; &amp;#39;&lt;/span&gt;&lt;span&gt;EOF&lt;/span&gt;&lt;span&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; &amp;gt;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; ~/upgrade-cargo.sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        FILE=$1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        PACKAGE=$2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        VERSION=$3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        result=$([ &amp;quot;null&amp;quot; != &amp;quot;$(tomlq &amp;#39;.dependencies&amp;#39; &amp;quot;$FILE&amp;quot; | jq .&amp;quot;$PACKAGE&amp;quot;)&amp;quot; ] &amp;amp;&amp;amp; tomlq -t &amp;quot;.dependencies.$PACKAGE.version = \&amp;quot;$VERSION\&amp;quot;&amp;quot; &amp;quot;$FILE&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        [ -n &amp;quot;$result&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;$result&amp;quot; &amp;gt; &amp;quot;$FILE&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        exit 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;      EOF&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Et finalement on rassemble tout !&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;cargo&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; metadata&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-format-version&lt;/span&gt;&lt;span class=&quot;z-l-9 z-d-14&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-no-deps&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt; jq&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.packages[] | .manifest_path | tostring&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;  xargs&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;I&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; {}&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;  bash&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; ~/upgrade-cargo.sh&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; {}&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;PACKAGE&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_VERSION&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;.gitlab-ci.yml&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tages&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ariables&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; gitlab token&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_TOKEN&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;CI_JOB_TOKEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; l&amp;#39;ID du projet qui supportera les crates par défaut le project du job&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_PROJECT_ID&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;CI_PROJECT_ID&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; API user&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_USER_API&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; J&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;OB-TOKEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; Host du proxy SSH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_ENDPOINT&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; n&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;oa-crates.cleverapps.io&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; Port d&amp;#39;écoute du proxy SSH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_PORT&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-9 z-d-14&quot;&gt; 22066&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; Utilisateur associé au token&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_USER&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ersonal-token&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; Package ciblé&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;dependencies&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; &amp;amp;&lt;/span&gt;&lt;span&gt;dependencies&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; dépendences&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;pt update &amp;amp;&amp;amp; apt install -y yq&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ssh-connexion&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; &amp;amp;&lt;/span&gt;&lt;span&gt;ssh-connexion&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; configuration SSH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;kdir -p ~/.ssh &amp;amp;&amp;amp; chmod -R 700 ~/.ssh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;    cat &amp;lt;&amp;lt; EOF &amp;gt; ~/.ssh/config &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;    Host $CRATE_PACKAGE_ENDPOINT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        User $CRATE_PACKAGE_USER:$CRATE_PACKAGE_TOKEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        Port $CRATE_PACKAGE_PORT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;    EOF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; création de la paire de clefs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; s&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;sh-keygen -t ed25519 -f ~/.ssh/id_ed25519&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; ajout de la clef publique du proxy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; s&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;sh-keyscan -p $CRATE_PACKAGE_PORT $CRATE_PACKAGE_ENDPOINT &amp;gt;&amp;gt; ~/.ssh/known_hosts&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;packaging&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; &amp;amp;&lt;/span&gt;&lt;span&gt;packaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; packaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;argo package -p $PACKAGE --allow-dirty&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;argo metadata --format-version 1 &amp;gt; metadata.json&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; l&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;s target/package/$CRATE_FILE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; upload&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;curl -i --header &amp;quot;$CRATE_PACKAGE_USER_API: $CRATE_PACKAGE_TOKEN&amp;quot; --upload-file target/package/${CRATE_FILE} &amp;quot;${CI_API_V4_URL}/projects/${CRATE_PACKAGE_PROJECT_ID}/packages/generic/${CRATE_NAME}/${CRATE_VERSION}/$CRATE_FILE&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;curl -i --header &amp;quot;$CRATE_PACKAGE_USER_API: $CRATE_PACKAGE_TOKEN&amp;quot; --upload-file metadata.json &amp;quot;${CI_API_V4_URL}/projects/${CRATE_PACKAGE_PROJECT_ID}/packages/generic/${CRATE_NAME}/${CRATE_VERSION}/metadata.json&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;version&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; &amp;amp;&lt;/span&gt;&lt;span&gt;version&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; récupération des informations du paquet&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;     export PACKAGE_DATA=$(cargo metadata --format-version 1 --no-deps | jq --arg PACKAGE &amp;quot;$PACKAGE&amp;quot; &amp;#39;(if (.packages | length ) &amp;gt; 1 then (.packages[] | select(.name == $PACKAGE)) else .packages[0] end) | {&amp;quot;name&amp;quot; : .name, &amp;quot;version&amp;quot;: .version, &amp;quot;manifest&amp;quot;: .manifest_path}&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; on quitte si le package n&amp;#39;existe&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;[ -z &amp;quot;$PACKAGE_DATA&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;Unknown package $PACKAGE in workspace&amp;quot; &amp;amp;&amp;amp; exit 1&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_NAME=$(jq &amp;quot;.name&amp;quot; &amp;lt;&amp;lt;&amp;lt; &amp;quot;$PACKAGE_DATA&amp;quot; | tr -d &amp;#39;&amp;quot;&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_VERSION=$(jq &amp;quot;.version&amp;quot; &amp;lt;&amp;lt;&amp;lt; &amp;quot;$PACKAGE_DATA&amp;quot; | tr -d &amp;#39;&amp;quot;&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CARGO_FILE=$(jq &amp;quot;.manifest&amp;quot; &amp;lt;&amp;lt;&amp;lt; &amp;quot;$PACKAGE_DATA&amp;quot; | tr -d &amp;#39;&amp;quot;&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_FILE=${CRATE_NAME}-${CRATE_VERSION}.crate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;prepare&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; &amp;amp;&lt;/span&gt;&lt;span&gt;prepare&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;dependencies&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ssh-connexion&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;version&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;release-dev&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  i&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;mage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; r&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ust:1.77&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; manuel&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  w&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;hen&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;anual&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; si la branche n&amp;#39;est pas main&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  r&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ules&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;f&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;cript&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;prepare&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; on créé la version flottante&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_VERSION=$CRATE_VERSION-$CI_COMMIT_SHORT_SHA&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_FILE=${CRATE_NAME}-${CRATE_VERSION}.crate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;      cat &amp;lt;&amp;lt; &amp;#39;EOF&amp;#39; &amp;gt; ~/upgrade-cargo.sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        FILE=$1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        PACKAGE=$2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        VERSION=$3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        result=$([ &amp;quot;null&amp;quot; != &amp;quot;$(tomlq &amp;#39;.dependencies&amp;#39; &amp;quot;$FILE&amp;quot; | jq .&amp;quot;$PACKAGE&amp;quot;)&amp;quot; ] &amp;amp;&amp;amp; tomlq -t &amp;quot;.dependencies.$PACKAGE.version = \&amp;quot;$VERSION\&amp;quot;&amp;quot; &amp;quot;$FILE&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        [ -n &amp;quot;$result&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;$result&amp;quot; &amp;gt; &amp;quot;$FILE&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        exit 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;      EOF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; On remplace la version&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;      cargo metadata --format-version 1 --no-deps | jq -r &amp;#39;.packages[] | .manifest_path | tostring&amp;#39; |  xargs -I {}  bash ~/upgrade-cargo.sh {} $PACKAGE $CRATE_VERSION&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; t&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;omlq --arg VERSION $CRATE_VERSION -t &amp;#39;.package.version = $VERSION&amp;#39; $CARGO_FILE &amp;gt; Cargo.toml.modified&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;v Cargo.toml.modified $CARGO_FILE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;packaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;release-prod&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  i&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;mage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; r&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ust:1.77&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; seulement si c&amp;#39;est main&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  o&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;nly&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ain&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;cript&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;prepare&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;packaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;elease-dev&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  e&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;xtends&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; .&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;release-dev&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  w&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;hen&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;anual&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  p&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;arallel&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;    m&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;atrix&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      -&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; P&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ACKAGE&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; w&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      -&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; P&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ACKAGE&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; w&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      -&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; P&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ACKAGE&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; w&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;elease-prod&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  e&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;xtends&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; .&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;release-prod&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  w&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;hen&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;anual&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  p&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;arallel&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;    m&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;atrix&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      -&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; P&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ACKAGE&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; w&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      -&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; P&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ACKAGE&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; w&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      -&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; P&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ACKAGE&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; w&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;3&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
    <entry xml:lang="fr">
        <title>Partie 2: Pipeline de CI</title>
        <published>2024-04-22T00:00:00+00:00</published>
        <updated>2024-04-22T00:00:00+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://staging.lafor.ge/crates-2/"/>
        <id>https://staging.lafor.ge/crates-2/</id>
        
        <content type="html" xml:base="https://staging.lafor.ge/crates-2/">&lt;details &gt;
	&lt;summary&gt;&lt;span&gt;Les articles de la série&lt;/span&gt;&lt;/summary&gt;
	&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;/crates-1&quot;&gt;Partie 1&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;/crates-3&quot;&gt;Partie 3&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;/details&gt;
&lt;p&gt;Bonjour à toutes et à tous 😀&lt;/p&gt;
&lt;p&gt;Dans l’article &lt;a href=&quot;/crates-1/&quot;&gt;précédent&lt;/a&gt; nous avons poussé à la main des crates en utilisant curl en local.&lt;/p&gt;
&lt;p&gt;Ce n’est pas du tout satisfaisant.&lt;/p&gt;
&lt;p&gt;Nous allons automatiser tout ça via la CI. Et comme nous avons commencé avec la package registry de Gitlab, on va également utilisé la Gitlab CI.&lt;/p&gt;
&lt;p&gt;J’ai un certain nombre d’exigences.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;une adresse unique pour toutes les crates, je ne veaux pas à avoir à me rappeler du chemin à chaque fois&lt;/li&gt;
&lt;li&gt;le versionnage est explicite et basé sur la version du package publié&lt;/li&gt;
&lt;li&gt;support des versions flottantes de dev&lt;/li&gt;
&lt;li&gt;ces versions de devs ont un versionnage implicite et automatique&lt;/li&gt;
&lt;li&gt;cela doit être le moins contraignant à utiliser, le moins de boilerplate possible&lt;/li&gt;
&lt;li&gt;il doit gérer les workspace Rust&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Autant dire qu’il y a un peu de travail.&lt;/p&gt;
&lt;h2 id=&quot;pipeline-de-ci-1o1&quot;&gt;Pipeline de CI 1o1&lt;/h2&gt;
&lt;p&gt;Commençons par la base.&lt;/p&gt;
&lt;p&gt;Si vous créez un fichier &lt;code&gt;.gitlab-ci.yml&lt;/code&gt; à la racine d’un projet git et que vous le poussez sur Gitlab, cela va indiquer à Gitlab qu’il faut lancer un pipeline de CI.&lt;/p&gt;
&lt;p&gt;Son format est le suivant&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;.gitlab-ci.yml&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tages&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; s&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;tage1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; s&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;tage2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ob1&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;    s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; s&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;tage1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ob2&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;    s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; s&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;tage1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ob3&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;    s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; s&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;tage2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Cela créé un graphe d’exécution qui va ressembler à ceci&lt;/p&gt;
&lt;pre class=&quot;mermaid&quot;&gt;
  

flowchart LR
    job1 --&gt;job3
    job2 --&gt; job3


&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;job1&lt;/code&gt; et &lt;code&gt;job2&lt;/code&gt; doivent tous les deux réussir si l’on veut que &lt;code&gt;job3&lt;/code&gt; s’exécute. Ce système de strates se nomme des &lt;em&gt;stages&lt;/em&gt; et permettent de réaliser des
checkpoints bloquants entre les différentes étapes.&lt;/p&gt;
&lt;p&gt;Par exemple ne packager que si le build est un succès est une bonne idée. 😎&lt;/p&gt;
&lt;p&gt;Nous nous allons définir un stage qui s’appellera &lt;code&gt;package&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Bon et maintenant, qu’est ce que l’on fait de nos jobs ?.&lt;/p&gt;
&lt;p&gt;La première chose est de définir une image qui sera notre environnement de packaging, nous faisons du rust, ça sera donc une image rust. Et de préférence versionnée.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;.gitlab-ci.yml&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ackage-crate&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;    i&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;mage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; r&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ust:1.77&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;    s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Nous allons écrire du bash, ce qui reste la meilleure façon d’intéragir avec un environnement.&lt;/p&gt;
&lt;p&gt;Et ce bash vient se mettre dans un &lt;em&gt;array&lt;/em&gt; nommé &lt;code&gt;scripts&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;.gitlab-ci.yml&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ackage-crate&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;    i&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;mage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; r&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ust:1.77&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;    s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;    s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;cript&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;cho &amp;quot;Hello World&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;packaging-en-ci&quot;&gt;Packaging en CI&lt;/h2&gt;
&lt;p&gt;D’abord récapitulons ce que nous avons fait en local:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;nous avons défini un &lt;code&gt;.ssh/config&lt;/code&gt; contenant le host de notre proxy&lt;/li&gt;
&lt;li&gt;nous avons lancé les commandes de packaging&lt;/li&gt;
&lt;li&gt;nous avons fait du curl&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ok, mimons ce fonctionnement.&lt;/p&gt;
&lt;p&gt;Tout d’abord occupons-nous du SSH.&lt;/p&gt;
&lt;p&gt;La première chose que l’on va faire c’est définir des informations sous forme de variable d’environnement&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;.gitlab-ci.yml&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ariables&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;    C&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;RATE_PACKAGE_ENDPOINT=$CRATES_ENDPOINT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;    C&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;RATE_PACKAGE_USER=personal-token&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Bien maintenant le packaging en lui-même.&lt;/p&gt;
&lt;p&gt;Il nécessite plusieurs éléments:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;l’addresse de l’API gitlab trouvable dans la variable injectée &lt;code&gt;$CI_API_V4_URL&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;la version du package&lt;/li&gt;
&lt;li&gt;le nom du package&lt;/li&gt;
&lt;li&gt;le chemin vers le fichier &lt;code&gt;.crate&lt;/code&gt; à générer à partier des informations précédentes&lt;/li&gt;
&lt;li&gt;le token que l’on possède déjà&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Pour rappel, cela à cette tête-là:&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;curl&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-header&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;PRIVATE-TOKEN: &lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;TOKEN&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-upload-file&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; target/package/&lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_FILE&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ENDPOINT&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/projects/&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;PROJECT_ID&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/packages/generic/&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_NAME&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_VERSION&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_FILE&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Commençons par récupérer le nom et la version du package.&lt;/p&gt;
&lt;p&gt;Pour cela nous pouvons utiliser un utiliser un utilitaire qui se nomme &lt;code&gt;tomlq&lt;/code&gt;, il vient avec &lt;code&gt;yq&lt;/code&gt; et permet de réaliser des requêtes &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://jqlang.github.io/jq/&quot;&gt;jq&lt;/a&gt; sur un fichier toml.&lt;/p&gt;
&lt;p&gt;Pour cela, on se rajoute la dépendance.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;apt&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; update&lt;/span&gt;&lt;span&gt; &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt; apt&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; install&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; yq&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Puis on génère nos variables.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; CRATE_NAME&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;=&lt;/span&gt;&lt;span&gt;$(&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;tomlq&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.package.name&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; Cargo.toml&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;  |&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt; tr&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; CRATE_NAME&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;=&lt;/span&gt;&lt;span&gt;$(&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;tomlq&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.package.version&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; Cargo.toml&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;  |&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt; tr&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On vient “trim” les guillemets qui vont nous ennuyer par la suite.&lt;/p&gt;
&lt;p&gt;On peut alors constituer notre &lt;code&gt;$CRATE_FILE&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; CRATE_FILE&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;=&lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_NAME&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;-&lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_VERSION&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;crate&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Il nous faut également un &lt;code&gt;$CRATE_PACKAGE_PROJECT_ID&lt;/code&gt; que l’on défini dans les variables d’environement&lt;/p&gt;
&lt;p&gt;Nous avons tous les ingédients, nous pouvons créer notre job.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;.gitlab-ci.yml&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tages&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ariables&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; gitlab token&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_TOKEN&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;CI_JOB_TOKEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; l&amp;#39;ID du projet qui supportera les crates par défaut le project du job&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_PROJECT_ID&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;CI_PROJECT_ID&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; API user&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_USER_API&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; J&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;OB-TOKEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ackage-crate&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  i&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;mage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; r&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ust:1.77&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;cript&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; dépendences&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;pt update &amp;amp;&amp;amp; apt install -y yq&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; récupération des informations du paquet&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_NAME=$(tomlq &amp;#39;.package.name&amp;#39; Cargo.toml  | tr -d &amp;#39;&amp;quot;&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_VERSION=$(tomlq &amp;#39;.package.version&amp;#39; Cargo.toml  | tr -d &amp;#39;&amp;quot;&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_FILE=${CRATE_NAME}-${CRATE_VERSION}.crate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; packaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;argo package&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;argo metadata --format-version 1 &amp;gt; metadata.json&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; upload&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;curl --header &amp;quot;$CRATE_PACKAGE_USER_API: $CRATE_PACKAGE_TOKEN&amp;quot; --upload-file target/package/${CRATE_FILE} &amp;quot;${CI_API_V4_URL}/projects/${CRATE_PACKAGE_PROJECT_ID}/packages/generic/${CRATE_NAME}/${CRATE_VERSION}/$CRATE_FILE&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;curl --header &amp;quot;$CRATE_PACKAGE_USER_API: $CRATE_PACKAGE_TOKEN&amp;quot; --upload-file metadata.json &amp;quot;${CI_API_V4_URL}/projects/${CRATE_PACKAGE_PROJECT_ID}/packages/generic/${CRATE_NAME}/${CRATE_VERSION}/metadata.json&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Si tout se passe bien, vous devriez voir apparaître dans la package registry de votre projet Gitlab un paquet &lt;code&gt;project v0.1.0&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Maintenant intéressons nous au cas où le projet nécessite une dépendence qui elle même est privée.&lt;/p&gt;
&lt;p&gt;On se créé un projet pour tester.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;cargo&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; init&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-lib&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; need_project&lt;/span&gt;&lt;span&gt; &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt; cd&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; need_project&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;mkdir&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; .cargo&lt;/span&gt;&lt;span&gt; &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt; cat&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; &amp;lt;&amp;lt;&lt;/span&gt;&lt;span&gt; EOF&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; &amp;gt;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; .cargo/config&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;[registries.private-crate]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;index = &amp;quot;ssh://noa-crates.cleverapps.io/noa-crates/project&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;[net]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;git-fetch-with-cli = true&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;EOF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;  &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;project = {version=&amp;quot;0.1.0&amp;quot;, registry=&amp;quot;private-crate&amp;quot;}&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; &amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; Cargo.toml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Comme vous pouvez le voir, nous allons devoir nous authentifier.&lt;/p&gt;
&lt;p&gt;Pour cela nous définissons dans l’objet &lt;code&gt;variables&lt;/code&gt; les différentes informations nécessaire à la connexion SSH.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;.gitlab-ci.yml&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ariables&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;    C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_TOKEN&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;CI_JOB_TOKEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;    C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_ENDPOINT&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; n&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;oa-crates.cleverapps.io&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;    C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_PORT&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-9 z-d-14&quot;&gt; 22066&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;    C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_USER&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ersonal-token&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On créé le répertoire &lt;code&gt;.ssh&lt;/code&gt; avec les bons droits&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;mkdir&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; ~/.ssh&lt;/span&gt;&lt;span&gt; &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt; chmod&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;R&lt;/span&gt;&lt;span class=&quot;z-l-9 z-d-14&quot;&gt; 700&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; ~/.ssh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Via &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://linuxize.com/post/bash-heredoc/&quot;&gt;heredoc&lt;/a&gt; nous générons la configuration SSH:&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;cat&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; &amp;lt;&amp;lt;&lt;/span&gt;&lt;span&gt; EOF&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; &amp;gt;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; ~/.ssh/config&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;Host &lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_PACKAGE_ENDPOINT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;    User &lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_PACKAGE_USER&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_PACKAGE_TOKEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;    Port &lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_PACKAGE_PORT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Mais cela n’est pas suffisant, il faut également générer une clef privée pour que la connexion SSH se fasse.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;ssh-keygen&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; ed25519&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; ~/.ssh/id_ed25519&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Et finalement récupérer la clef publique de notre proxy SSH, sinon la connexion échouera en non-intéractif car le endpoint n’est pas “connu”.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;ssh-keyscan&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_PACKAGE_PORT&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_PACKAGE_ENDPOINT&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; &amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; ~/.ssh/known_hosts&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ok, notre job de CI est maintenant capable de réaliser notre authentification au proxy.&lt;/p&gt;
&lt;p&gt;Nous pouvons rassembler les pièces du puzzle&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;.gitlab-ci.yml&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tages&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ariables&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; gitlab token&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_TOKEN&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;CI_JOB_TOKEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; l&amp;#39;ID du projet qui supportera les crates par défaut le project du job&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_PROJECT_ID&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;CI_PROJECT_ID&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; API user&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_USER_API&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; J&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;OB-TOKEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; Host du proxy SSH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_ENDPOINT&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; n&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;oa-crates.cleverapps.io&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; Port d&amp;#39;écoute du proxy SSH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_PORT&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-9 z-d-14&quot;&gt; 22066&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; Utilisateur associé au token&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_USER&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ersonal-token&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ackage-crate&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  i&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;mage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; r&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ust:1.77&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;cript&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; dépendences&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;pt update &amp;amp;&amp;amp; apt install -y yq&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; configuration SSH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;kdir -p ~/.ssh &amp;amp;&amp;amp; chmod -R 700 ~/.ssh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        cat &amp;lt;&amp;lt; EOF &amp;gt; ~/.ssh/config &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        Host $CRATE_PACKAGE_ENDPOINT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;            User $CRATE_PACKAGE_USER:$CRATE_PACKAGE_TOKEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;            Port $CRATE_PACKAGE_PORT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        EOF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; création de la paire de clefs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; s&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;sh-keygen -t ed25519 -f ~/.ssh/id_ed25519&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; ajout de la clef publique du proxy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; s&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;sh-keyscan -p $CRATE_PACKAGE_PORT $CRATE_PACKAGE_ENDPOINT &amp;gt;&amp;gt; ~/.ssh/known_hosts&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; récupération des informations du paquet&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_NAME=$(tomlq &amp;#39;.package.name&amp;#39; Cargo.toml  | tr -d &amp;#39;&amp;quot;&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_VERSION=$(tomlq &amp;#39;.package.version&amp;#39; Cargo.toml  | tr -d &amp;#39;&amp;quot;&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_FILE=${CRATE_NAME}-${CRATE_VERSION}.crate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; packaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;argo package&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;argo metadata --format-version 1 &amp;gt; metadata.json&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; upload&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;curl --header &amp;quot;$CRATE_PACKAGE_USER_API: $CRATE_PACKAGE_TOKEN&amp;quot; --upload-file target/package/${CRATE_FILE} &amp;quot;${CI_API_V4_URL}/projects/${CRATE_PACKAGE_PROJECT_ID}/packages/generic/${CRATE_NAME}/${CRATE_VERSION}/$CRATE_FILE&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;curl --header &amp;quot;$CRATE_PACKAGE_USER_API: $CRATE_PACKAGE_TOKEN&amp;quot; --upload-file metadata.json &amp;quot;${CI_API_V4_URL}/projects/${CRATE_PACKAGE_PROJECT_ID}/packages/generic/${CRATE_NAME}/${CRATE_VERSION}/metadata.json&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Et là c’est le drame 😫&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fatal: Could not read from remote repository.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Please make sure you have the correct access rights&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;and the repository exists.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Oui, votre &lt;code&gt;$CI_JOB_TOKEN&lt;/code&gt; n’a de droit que sur le projet &lt;code&gt;need_project&lt;/code&gt; pas &lt;code&gt;project&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Mais heureusement, il est possible de régler le souci en passant en paramètre du job un token apte à intéragir avec les deux projets, pour Gitlab SaaS en gratuit nous n’avons pas le choix, ça sera forcément des token personnels, mais pour des version self-hosted, il est possible de créer des group token.&lt;/p&gt;
&lt;p&gt;Bref, dans la configuration de la CI du projet &lt;code&gt;need_project&lt;/code&gt; rajouté une variable d’environnement &lt;code&gt;CRATE_PACKAGE_TOKEN&lt;/code&gt; avec votre token.&lt;/p&gt;
&lt;p&gt;Il faut également redéfinir le &lt;code&gt;CRATE_PACKAGE_USER_API&lt;/code&gt; à &lt;code&gt;PRIVATE-TOKEN&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;On relance&lt;/p&gt;
&lt;p&gt;Si tout est correct,&lt;/p&gt;
&lt;p&gt;Votre pipeline devrait afficher quelque part ceci:&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cargo package&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;warning: manifest has no description, license, license-file, documentation, homepage or repository.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   Packaging need_project v0.1.0 (/builds/noa-crates/need_project2)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   Verifying need_project v0.1.0 (/builds/noa-crates/need_project2)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Updating `private-crate` index&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;From ssh://noa-crates.cleverapps.io/noa-crates/project&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * [new ref]                    -&amp;gt; origin/HEAD&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; Downloading crates ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Downloaded project v0.1.0 (registry `private-crate`)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   Compiling project v0.1.0 (registry `private-crate`)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   Compiling need_project v0.1.0 (/builds/noa-crates/need_project2/target/package/need_project-0.1.0)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Finished dev [unoptimized + debuginfo] target(s) in 3.00s&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Cela prouve que votre arbre de dépendences privée est bien reconstruite en CI. 🤩&lt;/p&gt;
&lt;p&gt;Succès ⁉️&lt;/p&gt;
&lt;p&gt;Oui et non, c’est très contraignant de connaître toute cette mécanique, on ne gère pas encore les workspace et les versions de pre-release sont impossible à réaliser en l’état.&lt;/p&gt;
&lt;p&gt;Bref on repars en chasse !&lt;/p&gt;
&lt;h2 id=&quot;versions-de-pre-release&quot;&gt;Versions de pre-release&lt;/h2&gt;
&lt;p&gt;Qu’est ce qu’une version de pre-release pour moi ?&lt;/p&gt;
&lt;p&gt;Une version de pre-release c’est une version pas fini mais qui est nécessaire de packager pour d’autres développements.&lt;/p&gt;
&lt;p&gt;Si on se fie à la notation &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://doc.rust-lang.org/cargo/reference/semver.html&quot;&gt;semver&lt;/a&gt; suivie par cargo.&lt;/p&gt;
&lt;p&gt;Il est possible de créer des versions qui ne sont pas “finies” en les suffixant d’un attribut.&lt;/p&gt;
&lt;p&gt;par exemple &lt;code&gt;1.0.0-alpha.0&lt;/code&gt;, le suffixe de version &lt;code&gt;alpha.0&lt;/code&gt; indique la notion de pre-release de cette &lt;code&gt;1.0.0&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Mais on peut y mettre ce que l’on désire comme le SHA1 réduit de 8 caratères du commit de version.&lt;/p&gt;
&lt;p&gt;C’est ce que j’ai décidé de faire pour générer des versions comme &lt;code&gt;1.0.2-2e92f1ff&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Pour cela nous allons concaténer la version récupérer du Cargo.toml et la joindre au contenu de la varaible &lt;code&gt;$CI_COMMIT_SHORT_SHA&lt;/code&gt; injecté par le job.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; CRATE_VERSION&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_VERSION&lt;/span&gt;&lt;span&gt;-&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CI_COMMIT_SHORT_SHA&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ok easy non ?&lt;/p&gt;
&lt;p&gt;Alors non, si vous tentez de faire ça comme cela, la commande &lt;code&gt;cargo package&lt;/code&gt; n’utilisera pas votre version modifiée et créera un &lt;code&gt;target/package/project-0.1.0.crate&lt;/code&gt; au lieu
du &lt;code&gt;target/package/project-0.1.0-2e92f1ff.crate&lt;/code&gt; voulu.&lt;/p&gt;
&lt;p&gt;Il va falloir trafiquer le Cargo.toml pour mettre à jour la version.&lt;/p&gt;
&lt;p&gt;tomlq permet au moyen du paramètre &lt;code&gt;--arg&lt;/code&gt; d’injecter de l’environnement.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;tomlq&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-arg&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; VERSION&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_VERSION&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.package.version = $VERSION&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; Cargo.toml&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt; &amp;gt;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; Cargo.toml.modified&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;mv&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; Cargo.toml.modified&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; Cargo.toml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Et il faut également rajouter un paramètre &lt;code&gt;--allow-dirty&lt;/code&gt; pour packager sans avoir à commiter.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cargo package --allow-dirty&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On est bon ?&lt;/p&gt;
&lt;p&gt;Presque.&lt;/p&gt;
&lt;p&gt;Il faut que l’on découple les run entre la branche &lt;code&gt;main&lt;/code&gt; et les autres: je veux que le package de release ne se déclenche que sur la branche main et pas ailleurs.&lt;/p&gt;
&lt;p&gt;Et je veux également que le run du packaging de pre-release soit une tâche manuelle.&lt;/p&gt;
&lt;p&gt;Heuresement Gitlab Ci permet de configurer tout ceci.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;.gitlab-ci.yml&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tages&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;elease-dev&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;    s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; nécessite une intervention humaine&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;    w&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;hen&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;anual&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; si la branche n&amp;#39;est pas main&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;    r&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ules&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      -&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;f&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;elease-prod&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;    s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; seulement si c&amp;#39;est main&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;    o&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;nly&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;CI_DEFAULT_BRANCH&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Et maintenant on rempli&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tages&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ariables&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; gitlab token&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_TOKEN&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;CI_JOB_TOKEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; l&amp;#39;ID du projet qui supportera les crates par défaut le project du job&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_PROJECT_ID&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;CI_PROJECT_ID&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; API user&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_USER_API&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; J&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;OB-TOKEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; Host du proxy SSH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_ENDPOINT&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; n&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;oa-crates.cleverapps.io&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; Port d&amp;#39;écoute du proxy SSH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_PORT&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-9 z-d-14&quot;&gt; 22066&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; Utilisateur associé au token&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_USER&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ersonal-token&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;elease-dev&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  i&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;mage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; r&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ust:1.77&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; nécessite une intervention humaine&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  w&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;hen&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;anual&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; si la branche n&amp;#39;est pas main&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  r&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ules&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;f&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;cript&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; dépendences&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;pt update &amp;amp;&amp;amp; apt install -y yq&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; configuration SSH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;kdir -p ~/.ssh &amp;amp;&amp;amp; chmod -R 700 ~/.ssh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        cat &amp;lt;&amp;lt; EOF &amp;gt; ~/.ssh/config &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        Host $CRATE_PACKAGE_ENDPOINT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;            User $CRATE_PACKAGE_USER:$CRATE_PACKAGE_TOKEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;            Port $CRATE_PACKAGE_PORT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        EOF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; création de la paire de clefs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; s&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;sh-keygen -t ed25519 -f ~/.ssh/id_ed25519&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; ajout de la clef publique du proxy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; s&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;sh-keyscan -p $CRATE_PACKAGE_PORT $CRATE_PACKAGE_ENDPOINT &amp;gt;&amp;gt; ~/.ssh/known_hosts&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; récupération des informations du paquet&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_NAME=$(tomlq &amp;#39;.package.name&amp;#39; Cargo.toml  | tr -d &amp;#39;&amp;quot;&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_VERSION=$(tomlq &amp;#39;.package.version&amp;#39; Cargo.toml  | tr -d &amp;#39;&amp;quot;&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; on créé la version flottante&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_VERSION=$CRATE_VERSION-$CI_COMMIT_SHORT_SHA&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_FILE=${CRATE_NAME}-${CRATE_VERSION}.crate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; On remplace la version&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; t&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;omlq --arg VERSION $CRATE_VERSION -t &amp;#39;.package.version = $VERSION&amp;#39; Cargo.toml &amp;gt; Cargo.toml.modified&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;v Cargo.toml.modified Cargo.toml&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; packaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;argo package --allow-dirty&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;argo metadata --format-version 1 &amp;gt; metadata.json&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; upload&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;curl --header &amp;quot;$CRATE_PACKAGE_USER_API: $CRATE_PACKAGE_TOKEN&amp;quot; --upload-file target/package/${CRATE_FILE} &amp;quot;${CI_API_V4_URL}/projects/${CRATE_PACKAGE_PROJECT_ID}/packages/generic/${CRATE_NAME}/${CRATE_VERSION}/$CRATE_FILE&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;curl --header &amp;quot;$CRATE_PACKAGE_USER_API: $CRATE_PACKAGE_TOKEN&amp;quot; --upload-file metadata.json &amp;quot;${CI_API_V4_URL}/projects/${CRATE_PACKAGE_PROJECT_ID}/packages/generic/${CRATE_NAME}/${CRATE_VERSION}/metadata.json&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;elease-prod&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  i&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;mage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; r&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ust:1.77&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; seulement si c&amp;#39;est main&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  o&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;nly&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;CI_DEFAULT_BRANCH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;cript&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; dépendences&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;pt update &amp;amp;&amp;amp; apt install -y yq&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; configuration SSH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;kdir -p ~/.ssh &amp;amp;&amp;amp; chmod -R 700 ~/.ssh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        cat &amp;lt;&amp;lt; EOF &amp;gt; ~/.ssh/config &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        Host $CRATE_PACKAGE_ENDPOINT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;            User $CRATE_PACKAGE_USER:$CRATE_PACKAGE_TOKEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;            Port $CRATE_PACKAGE_PORT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        EOF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; création de la paire de clefs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; s&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;sh-keygen -t ed25519 -f ~/.ssh/id_ed25519&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; ajout de la clef publique du proxy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; s&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;sh-keyscan -p $CRATE_PACKAGE_PORT $CRATE_PACKAGE_ENDPOINT &amp;gt;&amp;gt; ~/.ssh/known_hosts&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; récupération des informations du paquet&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_NAME=$(tomlq &amp;#39;.package.name&amp;#39; Cargo.toml  | tr -d &amp;#39;&amp;quot;&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_VERSION=$(tomlq &amp;#39;.package.version&amp;#39; Cargo.toml  | tr -d &amp;#39;&amp;quot;&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_FILE=${CRATE_NAME}-${CRATE_VERSION}.crate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; packaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;argo package&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;argo metadata --format-version 1 &amp;gt; metadata.json&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; upload&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;curl --header &amp;quot;$CRATE_PACKAGE_USER_API: $CRATE_PACKAGE_TOKEN&amp;quot; --upload-file target/package/${CRATE_FILE} &amp;quot;${CI_API_V4_URL}/projects/${CRATE_PACKAGE_PROJECT_ID}/packages/generic/${CRATE_NAME}/${CRATE_VERSION}/$CRATE_FILE&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;curl --header &amp;quot;$CRATE_PACKAGE_USER_API: $CRATE_PACKAGE_TOKEN&amp;quot; --upload-file metadata.json &amp;quot;${CI_API_V4_URL}/projects/${CRATE_PACKAGE_PROJECT_ID}/packages/generic/${CRATE_NAME}/${CRATE_VERSION}/metadata.json&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Si l’on&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; checkout&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; `&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;dev&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; push&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-set-upstream&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; origin&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; dev&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Un pipeline avec une tâche manuelle va apparaître&lt;/p&gt;
&lt;p&gt;Et dedans normalement&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cargo package --allow-dirty&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   Packaging need_project v0.1.0-0eb85488 (/builds/noa-crates/need_project2)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   Verifying need_project v0.1.0-0eb85488 (/builds/noa-crates/need_project2)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Updating `private-crate` index&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;From ssh://noa-crates.cleverapps.io/noa-crates/project&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * [new ref]                    -&amp;gt; origin/HEAD&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; Downloading crates ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Downloaded project v0.1.0 (registry `private-crate`)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   Compiling project v0.1.0 (registry `private-crate`)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   Compiling need_project v0.1.0-0eb85488 (/builds/noa-crates/need_project2/target/package/need_project-0.1.0-0eb85488)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Finished dev [unoptimized + debuginfo] target(s) in 2.89s&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Packaged 6 files, 4.7KiB (1.8KiB compressed)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Félicitation, vous avez packagé votre version &lt;code&gt;0.1.0-0eb85488&lt;/code&gt; de &lt;code&gt;need_project&lt;/code&gt; et celle-ci peut alors se retrouver dans la package registry de &lt;code&gt;need_project&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&quot;factorisation&quot;&gt;Factorisation&lt;/h2&gt;
&lt;p&gt;Tout cela c’est très bien mais on voit bien que les étapes sont très semblables entre le job de release et de pre-release.&lt;/p&gt;
&lt;p&gt;Il doit être possible de mettre en place un système qui permet de factoriser ces répétitions, et ce mécanisme ne provient pas de Gitlab mais du format YAML, lui-même.&lt;/p&gt;
&lt;p&gt;Il s’agit des &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://support.atlassian.com/bitbucket-cloud/docs/yaml-anchors/&quot;&gt;YAML anchors&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Qu’est ce que l’on peut factoriser ?&lt;/p&gt;
&lt;p&gt;Tout d’abord les dépendences&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;dependencies&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; &amp;amp;&lt;/span&gt;&lt;span&gt;dependencies&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; dépendences&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;pt update &amp;amp;&amp;amp; apt install -y yq&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Puis la définition de la configuration SSH&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ssh-connexion&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; &amp;amp;&lt;/span&gt;&lt;span&gt;ssh-connexion:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; configuration SSH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;kdir -p ~/.ssh &amp;amp;&amp;amp; chmod -R 700 ~/.ssh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;    cat &amp;lt;&amp;lt; EOF &amp;gt; ~/.ssh/config &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;    Host $CRATE_PACKAGE_ENDPOINT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        User $CRATE_PACKAGE_USER:$CRATE_PACKAGE_TOKEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        Port $CRATE_PACKAGE_PORT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;    EOF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; création de la paire de clefs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; s&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;sh-keygen -t ed25519 -f ~/.ssh/id_ed25519&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; ajout de la clef publique du proxy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; s&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;sh-keyscan -p $CRATE_PACKAGE_PORT $CRATE_PACKAGE_ENDPOINT &amp;gt;&amp;gt; ~/.ssh/known_hosts&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ensuite, la récupération des informations du package.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;version&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; &amp;amp;&lt;/span&gt;&lt;span&gt;version&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; récupération des informations du paquet&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_NAME=$(tomlq &amp;#39;.package.name&amp;#39; Cargo.toml  | tr -d &amp;#39;&amp;quot;&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_VERSION=$(tomlq &amp;#39;.package.version&amp;#39; Cargo.toml  | tr -d &amp;#39;&amp;quot;&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_FILE=${CRATE_NAME}-${CRATE_VERSION}.crate&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Et finalement, le packaging en lui-même&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;packaging&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; &amp;amp;&lt;/span&gt;&lt;span&gt;packaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; packaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;argo package --allow-dirty&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;argo metadata --format-version 1 &amp;gt; metadata.json&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; l&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;s target/package/$CRATE_FILE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; upload&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;curl -i --header &amp;quot;$CRATE_PACKAGE_USER_API: $CRATE_PACKAGE_TOKEN&amp;quot; --upload-file target/package/${CRATE_FILE} &amp;quot;${CI_API_V4_URL}/projects/${CRATE_PACKAGE_PROJECT_ID}/packages/generic/${CRATE_NAME}/${CRATE_VERSION}/$CRATE_FILE&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;curl -i --header &amp;quot;$CRATE_PACKAGE_USER_API: $CRATE_PACKAGE_TOKEN&amp;quot; --upload-file metadata.json &amp;quot;${CI_API_V4_URL}/projects/${CRATE_PACKAGE_PROJECT_ID}/packages/generic/${CRATE_NAME}/${CRATE_VERSION}/metadata.json&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On peut alors jouer aux légos 🧱&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;prepare&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; &amp;amp;&lt;/span&gt;&lt;span&gt;prepare&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;dependencies&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ssh-connexion&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;version&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;elease-dev&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  i&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;mage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; r&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ust:1.77&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; manuel&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  w&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;hen&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;anual&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; si la branche n&amp;#39;est pas main&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  r&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ules&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;f&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;cript&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;prepare&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; on créé la version flottante&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_VERSION=$CRATE_VERSION-$CI_COMMIT_SHORT_SHA&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_FILE=${CRATE_NAME}-${CRATE_VERSION}.crate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; On remplace la version&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; t&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;omlq --arg VERSION $CRATE_VERSION -t &amp;#39;.package.version = $VERSION&amp;#39; Cargo.toml &amp;gt; Cargo.toml.modified&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;v Cargo.toml.modified Cargo.toml&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;packaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;elease-prod&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  i&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;mage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; r&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ust:1.77&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; seulement si c&amp;#39;est main&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  o&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;nly&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ain&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;cript&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;prepare&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;packaging&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;C’est quand même plus clean comme ça 😀&lt;/p&gt;
&lt;details &gt;
	&lt;summary&gt;&lt;span&gt;.gitlab-ci.yml&lt;/span&gt;&lt;/summary&gt;
	&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tages&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ariables&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; gitlab token&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_TOKEN&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;CI_JOB_TOKEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; l&amp;#39;ID du projet qui supportera les crates par défaut le project du job&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_PROJECT_ID&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;CI_PROJECT_ID&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; API user&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_USER_API&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; J&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;OB-TOKEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; Host du proxy SSH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_ENDPOINT&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; n&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;oa-crates.cleverapps.io&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; Port d&amp;#39;écoute du proxy SSH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_PORT&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-9 z-d-14&quot;&gt; 22066&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; Utilisateur associé au token&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  C&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;RATE_PACKAGE_USER&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ersonal-token&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;dependencies&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; &amp;amp;&lt;/span&gt;&lt;span&gt;dependencies&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; dépendences&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;pt update &amp;amp;&amp;amp; apt install -y yq&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ssh-connexion&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; &amp;amp;&lt;/span&gt;&lt;span&gt;ssh-connexion&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; configuration SSH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;kdir -p ~/.ssh &amp;amp;&amp;amp; chmod -R 700 ~/.ssh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;    cat &amp;lt;&amp;lt; EOF &amp;gt; ~/.ssh/config &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;    Host $CRATE_PACKAGE_ENDPOINT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        User $CRATE_PACKAGE_USER:$CRATE_PACKAGE_TOKEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;        Port $CRATE_PACKAGE_PORT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;    EOF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; création de la paire de clefs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; s&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;sh-keygen -t ed25519 -f ~/.ssh/id_ed25519&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; ajout de la clef publique du proxy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; s&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;sh-keyscan -p $CRATE_PACKAGE_PORT $CRATE_PACKAGE_ENDPOINT &amp;gt;&amp;gt; ~/.ssh/known_hosts&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;packaging&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; &amp;amp;&lt;/span&gt;&lt;span&gt;packaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; packaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;argo package --allow-dirty&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;argo metadata --format-version 1 &amp;gt; metadata.json&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; l&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;s target/package/$CRATE_FILE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; upload&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;curl -i --header &amp;quot;$CRATE_PACKAGE_USER_API: $CRATE_PACKAGE_TOKEN&amp;quot; --upload-file target/package/${CRATE_FILE} &amp;quot;${CI_API_V4_URL}/projects/${CRATE_PACKAGE_PROJECT_ID}/packages/generic/${CRATE_NAME}/${CRATE_VERSION}/$CRATE_FILE&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;curl -i --header &amp;quot;$CRATE_PACKAGE_USER_API: $CRATE_PACKAGE_TOKEN&amp;quot; --upload-file metadata.json &amp;quot;${CI_API_V4_URL}/projects/${CRATE_PACKAGE_PROJECT_ID}/packages/generic/${CRATE_NAME}/${CRATE_VERSION}/metadata.json&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;version&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; &amp;amp;&lt;/span&gt;&lt;span&gt;version&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; récupération des informations du paquet&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_NAME=$(tomlq &amp;#39;.package.name&amp;#39; Cargo.toml  | tr -d &amp;#39;&amp;quot;&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_VERSION=$(tomlq &amp;#39;.package.version&amp;#39; Cargo.toml  | tr -d &amp;#39;&amp;quot;&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_FILE=${CRATE_NAME}-${CRATE_VERSION}.crate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;prepare&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; &amp;amp;&lt;/span&gt;&lt;span&gt;prepare&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;dependencies&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ssh-connexion&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;version&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;elease-dev&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  i&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;mage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; r&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ust:1.77&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; manuel&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  w&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;hen&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;anual&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; si la branche n&amp;#39;est pas main&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  r&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ules&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;f&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;cript&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;prepare&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; on créé la version flottante&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_VERSION=$CRATE_VERSION-$CI_COMMIT_SHORT_SHA&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;xport CRATE_FILE=${CRATE_NAME}-${CRATE_VERSION}.crate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;    #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; On remplace la version&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; t&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;omlq --arg VERSION $CRATE_VERSION -t &amp;#39;.package.version = $VERSION&amp;#39; Cargo.toml &amp;gt; Cargo.toml.modified&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;v Cargo.toml.modified Cargo.toml&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;packaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;elease-prod&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  i&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;mage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; r&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ust:1.77&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;tage&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ackaging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;  #&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; seulement si c&amp;#39;est main&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  o&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;nly&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ain&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;cript&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;prepare&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;/span&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt; *&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;packaging&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/details&gt;
&lt;p&gt;Pour le &lt;a href=&quot;/crates-3&quot;&gt;prochain&lt;/a&gt;, article on verra comment gérer le problème épineux des workspaces.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="fr">
        <title>Partie 1: Présentation, Installation du Proxy et action manuelle</title>
        <published>2024-04-21T00:00:00+00:00</published>
        <updated>2024-04-21T00:00:00+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://staging.lafor.ge/crates-1/"/>
        <id>https://staging.lafor.ge/crates-1/</id>
        
        <content type="html" xml:base="https://staging.lafor.ge/crates-1/">&lt;details &gt;
	&lt;summary&gt;&lt;span&gt;Les articles de la série&lt;/span&gt;&lt;/summary&gt;
	&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;/crates-2&quot;&gt;Partie 2&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;/crates-3&quot;&gt;Partie 3&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;/details&gt;
&lt;p&gt;Bonjour à toutes et à tous 😀&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://crates.io&quot;&gt;crates.io&lt;/a&gt;, c’est vraiment bien, c’est une plateforme qui unifie toutes les crates publiques en un seul point.&lt;/p&gt;
&lt;p&gt;Mais il est là le souci, crates &lt;em&gt;publiques&lt;/em&gt;, dès que l’on veut avoir des crates &lt;strong&gt;privées&lt;/strong&gt;, cela devient plus complexe à cause de l’authentification nécessaire.&lt;/p&gt;
&lt;p&gt;Cargo permet au moyen d’un fichier addon &lt;code&gt;.cargo/config.toml&lt;/code&gt;, à définir au niveau du projet où du système entier, de spécifier des registries privées en utilisant la nomenclature&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;.cargo/config.toml&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;toml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;registries&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;my-private-registry&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;index&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;Endpoint URL&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Et peut alors s’utiliser dans un &lt;code&gt;Cargo.toml&lt;/code&gt; comme n’importe quelle crate.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Cargo.toml&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;toml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;package&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;dependencies&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;private-crate&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;version&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;1.0.0&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; registry&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;my-private-registry&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; }&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Et si en plus d’être privée, votre registry nécessite de l’authentification alors vous devez vous bâtir votre propre système de &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://doc.rust-lang.org/cargo/reference/credential-provider-protocol.html&quot;&gt;credential provider&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Il existe diverses solutions comme &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://jfrog.com/help/r/jfrog-artifactory-documentation/cargo-package-registry&quot;&gt;artifactory&lt;/a&gt;, &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://kellnr.io/&quot;&gt;kellnr&lt;/a&gt; ou s’installer son propre &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://github.com/rust-lang/crates.io/blob/main/docs/CONTRIBUTING.md#using-your-local-cratesio-with-cargo&quot;&gt;crates.io&lt;/a&gt; qui tendent à rapprocher l’expérience de dev la plus proche d’un &lt;code&gt;crates.io&lt;/code&gt; classique.&lt;/p&gt;
&lt;p&gt;Toutes ces solutions sont cools, mais nécessitent de la maintenance et moi, je suis fainéant. Je ne veux pas à avoir à setup un autre bidule contraignant.&lt;/p&gt;
&lt;p&gt;C’est alors que j’ai découvert une solution des plus élégantes, il s’agit de &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://github.com/w4/gitlab-cargo-shim&quot;&gt;gitlab-cargo-shim&lt;/a&gt;, un projet sous licence &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://choosealicense.com/licenses/wtfpl/&quot;&gt;WTFPL&lt;/a&gt; qui fait le juste travail que je lui demande.&lt;/p&gt;
&lt;p&gt;Son principe de fonctionnement est fort simple. Gitlab dispose (même en version SaaS) d’une &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://docs.gitlab.com/ee/user/packages/generic_packages/&quot;&gt;package registry generic&lt;/a&gt;. Celle-ci permet au moyen d’appels API authentifiés par &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html&quot;&gt;token d’accès&lt;/a&gt; (personnel, de groupe, de projet, de CI) de venir pousser et télécharger de la données dans un bucket S3.&lt;/p&gt;
&lt;p&gt;L’idée est donc de mettre à profit cette API de package registry, pour venir y stocker les fichiers &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://github.com/rust-lang/cargo/blob/534ce68621ce4feec0b7e8627cfd3b077d4f3900/src/cargo/ops/cargo_package.rs#L185&quot;&gt;.crate&lt;/a&gt; qui sont basiquement des archives de projets.&lt;/p&gt;
&lt;p&gt;Profitons de ce backend déjà existant 😄&lt;/p&gt;
&lt;p&gt;Le problème est&lt;/p&gt;
&lt;blockquote class=&quot;markdown-alert-question&quot;&gt;
	&lt;p&gt;Comment faire parler cargo en API Gitlab?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Et comme généralement dans ces cas de transitions de protocoles la réponse est : un proxy!&lt;/p&gt;
&lt;p&gt;Nous avons donc un proxy qui parle à la fois le “cargo” et le “gitlab” et gitlab parle à son bucket S3.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+--------+     +-------+   +--------+    +----+ &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;| Cargo  &amp;lt;-----&amp;gt; Proxy &amp;lt;---&amp;gt; Gitlab &amp;lt;----&amp;gt; S3 | &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+--------+     +-------+   +--------+    +----+ &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Deuxième problème&lt;/p&gt;
&lt;blockquote class=&quot;markdown-alert-question&quot;&gt;
	&lt;p&gt;Comment authentifier les appels de cargo vers Gitlab?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;En effet, pour que le proxy puisse intéragir avec la package registry via un appel API, celui-ci doit comporter le token d’authentification.&lt;/p&gt;
&lt;p&gt;Il faut donc réussir à réaliser ceci.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌───────┐  Token   ┌───────┐  Token  ┌────────┐     &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│ Cargo ├──────────► Proxy ├─────────► Gitlab │     &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└───────┘   ???    └───────┘   API   └────────┘     &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                              HTTPS                                                          &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;La question que l’on doit alors se poser c’est qu’est que l’on met à la place des &lt;code&gt;???&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Cargo parle plusieurs protocoles:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;git&lt;/li&gt;
&lt;li&gt;ssh&lt;/li&gt;
&lt;li&gt;https&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Nous n’allons pas utiliser git car c’est un protocole trop spécialisé pour ce que l’on a besoin de faire, nous ne pouvons pas non plus utiliser https car l’ajout mot de passe dans une URL est très peu recommandé pour des raisons évidentes de sécurité.&lt;/p&gt;
&lt;p&gt;Il nous reste SSH.&lt;/p&gt;
&lt;p&gt;Mais le problème reste entier, comment transmettre de manière sécurisée le token d’authentification pour l’API Gitlab ?&lt;/p&gt;
&lt;p&gt;Et c’est là qu’on peut être extrêment malin.&lt;/p&gt;
&lt;p&gt;Lorsque l’on se connecte au travers de SSH on le fait toujours au travers d’un utilisateur, et le format du nom de l’utilisateur n’a pas vraiment de formalisme.&lt;/p&gt;
&lt;p&gt;L’idée est donc de faire pareil qu’avec le https.&lt;/p&gt;
&lt;p&gt;Mais au  lieu de le mettre dans l’URL en clair c’est le protocole SSH qui le transmettra de manière sécurisée une fois le handshake réalisé.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;.cargo/config.toml&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;toml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;registries&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;my-private-registry&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;index&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ssh://personal-token:[TOKEN]@[ENDPOINT]&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Sur le papier c’est bien, sauf que les créateur de cargo n’ont pas fais dans la dentelles sur l’interdiction des &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://doc.rust-lang.org/nightly/nightly-rustc/src/cargo/util/context/mod.rs.html#1645&quot;&gt;mots de passes&lt;/a&gt; dans l’URL d’une registry.&lt;/p&gt;
&lt;p&gt;Mais c’est là que l’on peut être doublement malin.&lt;/p&gt;
&lt;p&gt;SSH vient avec un fichier qui se nomme &lt;code&gt;.ssh/config&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Dedans, il est possible par host de définir des règles à exécuter. Nous tout ce que l’on veut c’est que l’URL reste immaculé de mot de passe mais qu’il soit tout de même transmit.&lt;/p&gt;
&lt;p&gt;Le fichier de config à ce pouvoir&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;.ssh/config&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Host ENDPOINT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    User personal-token:TOKEN&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Et voilà ! Maintenant le token arrive jusqu’au proxy ! Qui peut alors réaliser en délégation de droits, les calls API sur Gitlab et transmettre les réponses dans le stream SSH.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌───────┐  Token   ┌───────┐  Token  ┌────────┐    ┌────┐ &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│ Cargo ◄──────────► Proxy ◄─────────► Gitlab ◄────► S3 │ &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└───────┘   SSH    └───────┘   API   └────────┘    └────┘ &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                              HTTPS&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Il nous faut maintenant le proxy.&lt;/p&gt;
&lt;p&gt;Vous pouvez très bien le faire tourner en local mais j’ai décider de l’héberger chez &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://www.clever-cloud.com/fr/home/&quot;&gt;clever-cloud&lt;/a&gt; car cela sera plus pratique pour la suite.&lt;/p&gt;
&lt;p&gt;Commençons.&lt;/p&gt;
&lt;p&gt;Installons les &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://github.com/CleverCloud/clever-tools&quot;&gt;clever-tools&lt;/a&gt;.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npm i -g clever-tools&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
	&lt;p&gt;Je vous conseil une version node 20 d’installé sinon il va râler.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;On s’authentifie&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;clever login&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Puis on créé une app une application nodeJS, oui c’est chelou mais comme notre proxy ne parle que SSH, lorsque l’on va venir vérifier si le port HTTP 8080 répond, ça ne marchera pas.&lt;/p&gt;
&lt;p&gt;On va donc ruser un peu.&lt;/p&gt;
&lt;p&gt;On clone notre proxy&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git clone https://github.com/w4/gitlab-cargo-shim.git &amp;amp;&amp;amp; gitlab-cargo-shim&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Puis on crée l’application&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;clever create --type node&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Your application has been successfully created!&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ID: app_bf53be9f-abbc-421d-9a43-c097cfc476e9&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
	&lt;p&gt;Il est possible de définir l’organisation de l’application avec le paramètre &lt;code&gt;--org&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;On lie l’application et le dépôt avec&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;clever link app_bf53be9f-abbc-421d-9a43-c097cfc476e9&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On se met dans une branche&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git branch clever&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git switch clever&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On créé un fichier à la racine du projet &lt;code&gt;package.json&lt;/code&gt; avec le contenu suivant.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;    &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;    &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;scripts&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; :&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;        &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;cargo build --release&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On commit.&lt;/p&gt;
&lt;p&gt;Sur la &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https://console.clever-cloud.com/&quot;&gt;console&lt;/a&gt; on vient rajouter plusieurs variable d’environement:&lt;/p&gt;
&lt;p&gt;D’abord &lt;code&gt;CONFIG&lt;/code&gt; avec le contenu suivant&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;toml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;# socket address for the SSH server to listen on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;listen-address&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;[::]:4040&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;# directory in which the generated private keys for the server&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;# should be stored&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;state-directory&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/home/bas/state&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;gitlab&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;# the base url of the gitlab instance&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;uri&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;https://gitlab.com&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;Le port &lt;code&gt;4040&lt;/code&gt; est obligatoire.&lt;/li&gt;
&lt;li&gt;Le &lt;code&gt;/home/bas/state&lt;/code&gt; permet d’avoir un endroit où l’application a les droits en écritures.&lt;/li&gt;
&lt;li&gt;L’ &lt;code&gt;uri&lt;/code&gt; est à votre convenance, moi je vais utiliser l’instance SaaS de Gitlab mais vous êtes libre d’utiliser votre instance privée.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Puis qui créé la configuration et lance le binaire&lt;/p&gt;
&lt;p&gt;&lt;code&gt;CC_RUN_COMMAND = echo &quot;${CONFIG}&quot; &amp;gt; /home/bas/config.toml &amp;amp;&amp;amp; target/release/gitlab-cargo-shim --config /home/bas/config.toml&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Qui démarre un serveur HTTP sur le port 8080 en background et répond “OK”&lt;/p&gt;
&lt;p&gt;&lt;code&gt;CC_PRE_RUN_HOOK = mkdir -p dist &amp;amp;&amp;amp; echo OK &amp;gt; dist/index.html &amp;amp;&amp;amp; (python3 -m http.server -d dist 8080)&amp;amp;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Et enfin qui va cacher uniquement le &lt;code&gt;package.json&lt;/code&gt; et le binaire à l’issu de l’étape de build, passant de 1Go à 17Mo le cache 😁&lt;/p&gt;
&lt;p&gt;&lt;code&gt;CC_OVERRIDE_BUILDCACHE = /package.json:/target/release/gitlab-cargo-shim&lt;/code&gt;&lt;/p&gt;
&lt;details &gt;
	&lt;summary&gt;&lt;span&gt;Tout l&#39;env en un clic&lt;/span&gt;&lt;/summary&gt;
	&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt;CC_OVERRIDE_BUILDCACHE&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/package.json:/target/release/gitlab-cargo-shim&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt;CC_PRE_RUN_HOOK&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;mkdir -p dist &amp;amp;&amp;amp; echo OK &amp;gt; dist/index.html &amp;amp;&amp;amp; (python3 -m http.server -d dist 8080)&amp;amp;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt;CC_RUN_COMMAND&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;echo \&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;${CONFIG}\&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;gt; /home/bas/config.toml &amp;amp;&amp;amp; target/release/gitlab-cargo-shim --config /home/bas/config.toml&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-6 z-d-10&quot;&gt;CONFIG&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;## socket address for the SSH server to listen on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;listen-address = \&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;[::]:4040\&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;## directory in which the generated private keys for the server&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;## should be stored&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;state-directory = \&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;/home/bas/state\&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;[gitlab]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;## the base url of the gitlab instance&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;uri = \&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;https://gitlab.com\&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/details&gt;
&lt;p&gt;Je vous conseille également d’activer l’utilisation d’une instance de build dans Information -&amp;gt; Enable dedicated build instance, et de la passer en XL si vous ne voulez pas
mourrir d’ennuie en attendant le build.&lt;/p&gt;
&lt;p&gt;Votre instance de run peut rester une XS.&lt;/p&gt;
&lt;p&gt;Vous pouvez également lui ajouter un domain perso. Moi ça sera &lt;code&gt;noa-crates.cleverapps.io&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Finalement activez la redirection tcp&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;clever tcp-redirs add --namespace cleverapps&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Vous allez obtenir un numéro de port, c’est celui-ci qui sera redirigé vers le port 4040 de notre proxy SSH.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Successfully added tcp redirection on port: 22066&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On configure le &lt;code&gt;.ssh/config&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Host noa-crates.cleverapps.io&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    User personal-token:TOKEN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Port 22066&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Vous pouvez maintenant déployer&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;clever deploy&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Après plusieurs minutes de build, votre app est up and running et prête à recevoir du SSH.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh noa-crates.cleverapps.io&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Cela prend un certain temps et non ce n’est pas encore la faille xz qui ralenti la connexion, mais simplement le trajet très étendu qui fait un call sur Gitlab.&lt;/p&gt;
&lt;p&gt;En effet voici la réponse&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Hi there, Akanoa! You&amp;#39;ve successfully authenticated, but gitlab-cargo-shim does not provide shell access.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Connection to noa-crates.cleverapps.io closed.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Le &lt;code&gt;Akanoa&lt;/code&gt; est une information connu de seul Gitlab, ce qui prouve à la fois que le SSH répond mais aussi que le proxy utilise bel et bien mon token pour opérer sur Gitlab!! 🤩&lt;/p&gt;
&lt;p&gt;Et donc comment pouvons nous utiliser notre système avec cargo ?&lt;/p&gt;
&lt;p&gt;Déjà nous ne ferons pas de &lt;code&gt;cargo publish&lt;/code&gt;, il est trop &lt;em&gt;opiniated&lt;/em&gt; et va nous géner.&lt;/p&gt;
&lt;p&gt;Par contre, nous pouvons décomposer ses étapes pour créer notre flux de commandes.&lt;/p&gt;
&lt;p&gt;Testons à partir d’un projet vide.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cargo init project --lib &amp;amp;&amp;amp; cd project&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On lance d’abord un&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cargo package --allow-dirty&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
	&lt;p&gt;&lt;code&gt;--allow-dirty&lt;/code&gt; permet de ne pas à avoir à committer les modifications&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Cela créé un fichier &lt;code&gt;target/package/project-0.1.0.crate&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Dedans on y trouve seulement une archive de notre projet.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tar -tvf target\package\project-0.1.0.crate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-r--r--  0 0      0         545 janv. 01  1970 project-0.1.0/Cargo.toml&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-r--r--  0 0      0          78 nov. 29  1973 project-0.1.0/Cargo.toml.orig&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-r--r--  0 0      0         216 nov. 29  1973 project-0.1.0/src/lib.rs&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On génère également un manifeste qui contient tout de sorte de métadonnées.&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cargo metadata --format-version 1 &amp;gt; metadata.json&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Je ne le mets pas en entier ici, mais il contient la résolution de l’arbre de dépendances du projet et d’autres informations dont une représentation du Cargo.toml dans notre archive.&lt;/p&gt;
&lt;p&gt;Ok, et maintenant, on fait comment pour l’envoyer sur Gitlab ?&lt;/p&gt;
&lt;p&gt;Et bien c’est simple: &lt;code&gt;curl&lt;/code&gt; 😄 Et je ne déconne même pas. Nous allons utiliser l’API de Gitlab comme elle doit être utilisée.&lt;/p&gt;
&lt;p&gt;Mais d’abord, il nous faut un projet.&lt;/p&gt;
&lt;p&gt;On en créé un sur Gitlab et on récupère le project ID qui se trouve dans les 3 points verticaux en haut à droite &lt;code&gt;⋮&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Ici ça sera 57111774.&lt;/p&gt;
&lt;blockquote class=&quot;markdown-alert-warning&quot;&gt;
	&lt;p&gt;Vérifiez bien que dans les paramètres du projet dans &lt;code&gt;/settings/packages_and_registries&lt;/code&gt;, que le “Number of duplicate assets to keep” est bien à 1 !&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;TOKEN&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;o&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt; token]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;PROJECT_ID&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_NAME&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;o&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;t&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_VERSION&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_FILE&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_NAME&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_VERSION&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;e&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ENDPOINT&lt;/span&gt;&lt;span class=&quot;z-l-3 z-d-3&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;g&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;l&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;o&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;curl&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-header&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;PRIVATE-TOKEN: &lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;TOKEN&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-upload-file&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; target/package/&lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_FILE&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ENDPOINT&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/projects/&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;PROJECT_ID&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/packages/generic/&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_NAME&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_VERSION&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_FILE&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-2 z-d-4&quot;&gt;curl&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-header&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;PRIVATE-TOKEN: &lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;TOKEN&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;z-l-4 z-d-11&quot;&gt;-upload-file&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; metadata.json&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;ENDPOINT&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/projects/&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;PROJECT_ID&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/packages/generic/&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_NAME&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;CRATE_VERSION&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;/metadata.json&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ici cela donne&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl --header &amp;#39;PRIVATE-TOKEN: ***REDACTED***&amp;#39; --upload-file target/package/project-0.1.0 https://gitlab.com/api/v4/projects/57111774/packages/generic/project/0.1.0/project-0.1.0.crate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl --header &amp;#39;PRIVATE-TOKEN: ***REDACTED***&amp;#39; --upload-file metadata.json https://gitlab.com/api/v4/projects/57111774/packages/generic/project/0.1.0/metadata.json&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Si vous vous dirigez dans la &lt;code&gt;package registry&lt;/code&gt; du projet vous verrez que le paquet &lt;code&gt;project-0.1.0&lt;/code&gt; est bien présent et dedans vous pourrez apercevoir le &lt;code&gt;project-0.1.0.crate&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Et maintenant comment ça s’utilise dans un projet qui a bien de &lt;code&gt;project-0.1.0&lt;/code&gt; ?&lt;/p&gt;
&lt;p&gt;Pas du curl quand même ???&lt;/p&gt;
&lt;p&gt;Non, non, on va enfin utiliser le proxy ^^&lt;/p&gt;
&lt;p&gt;On se créé un nouveau projet&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cargo init need_project&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Puis on créé le&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;.cargo/config&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;toml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;registries&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;private-crate&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;index&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ssh://[proxy endpoint]/[path project]&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;net&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;git-fetch-with-cli&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span class=&quot;z-l-9 z-d-14&quot;&gt; true&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;blockquote class=&quot;markdown-alert-warning&quot;&gt;
	&lt;p&gt;Attention à ne pas oublier le &lt;code&gt;net.git-fetch-with-cli = true&lt;/code&gt;, sinon rien ne marche !!&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Pour moi &lt;code&gt;proxy endpoint&lt;/code&gt; sera “noa-crates.cleverapps.io”. Il faut simplement qu’il corresponde au HostName de votre &lt;code&gt;.ssh/config&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Le &lt;code&gt;path project&lt;/code&gt; est celui de votre projet gitlab qui possède la package registry. Moi ça sera “noa-crates/project”.&lt;/p&gt;
&lt;p&gt;Ce qui me donne&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;.cargo/config&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;toml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;registries&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;private-crate&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;index&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;ssh://noa-crates.cleverapps.io/noa-crates/project&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;net&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;git-fetch-with-cli&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span class=&quot;z-l-9 z-d-14&quot;&gt; true&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ensuite on utilise la dépendence classiquement&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;.cargo/config.toml&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;toml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;package&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;z-l-7 z-d-7&quot;&gt; ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;dependencies&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;project&lt;/span&gt;&lt;span&gt; =&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt;version&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;0.1.0&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span class=&quot;z-l-8 z-d-8&quot;&gt; registry&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;private-crate&lt;/span&gt;&lt;span class=&quot;z-l-5 z-d-5&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Si on build&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cargo build&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   Compiling project v0.1.0 (registry `private-crate`)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   Compiling need-project v0.1.0 (/data/need-project)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.95s&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On voit que la dépendence &lt;code&gt;project v0.1.0&lt;/code&gt; a bien été tirée.&lt;/p&gt;
&lt;p&gt;Notre package registry fonctionne 😁&lt;/p&gt;
&lt;p&gt;Dans le &lt;a href=&quot;/crates-2&quot;&gt;prochain&lt;/a&gt; article on verra comment industrialiser tout ça ^^&lt;/p&gt;
</content>
        
    </entry>
</feed>
