<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Alexander Praschek on Medium]]></title>
        <description><![CDATA[Stories by Alexander Praschek on Medium]]></description>
        <link>https://medium.com/@miragon?source=rss-db0d46ea6585------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xB97_gXW_WOhMcD9D7FGDA.jpeg</url>
            <title>Stories by Alexander Praschek on Medium</title>
            <link>https://medium.com/@miragon?source=rss-db0d46ea6585------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 08:31:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@miragon/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Impact of Digitalization: A
Multifaceted Analysis of Economy, Society, and the Individual]]></title>
            <link>https://medium.com/miragon/the-impact-of-digitalization-a-multifaceted-analysis-of-economy-society-and-the-individual-8266647e5be9?source=rss-db0d46ea6585------2</link>
            <guid isPermaLink="false">https://medium.com/p/8266647e5be9</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[digitalization]]></category>
            <category><![CDATA[digital-transformation]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Alexander Praschek]]></dc:creator>
            <pubDate>Tue, 25 Jul 2023 13:39:12 GMT</pubDate>
            <atom:updated>2023-07-25T13:39:12.934Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ICvIPlZxEwBISVZz0QtAdg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@choys_?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Conny Schneider</a> on <a href="https://unsplash.com/de/fotos/Xz6ZKQ-oFvc?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p><em>Posted by </em><a href="https://medium.com/@rami.nakkar00"><em>Rami Nakkar</em></a><em>, Software Developer at Miragon GmbH</em></p><p>Digitalization has become a ubiquitous term in today’s world, referring to the use of digital technologies to transform business models, create new revenue streams, and improve efficiency. The impact of digitalization is far-reaching, affecting various aspects of our lives, including the <strong>economy</strong>, <strong>society</strong>, and <strong>individuals</strong>.<br>From the rise of e-commerce to the proliferation of social media platforms, digitalization has changed the way we interact with each other and conduct business. In this context, it is important to understand the <strong>implications of digitalization</strong> and how it is shaping our future. This requires a nuanced understanding of its benefits and challenges, as well as its potential impact on different facets of our life. In this essay, we will explore the impact of digitalization on the economy, society, and the individual.</p><h4><strong>The Concept and Process of Digitalization</strong></h4><p>The mentioned definition of digitalization is just one of many. Defining it clearly is a complex task due to its broad and multidimensional nature. <a href="https://www.diva-portal.org/smash/record.jsf?pid=diva2%3A1758116&amp;dswid=339">Marcus Heidlund and Leif Sundberg</a>, for instance, emphasize the public sector perspective in their definition, describing digitalization as <strong>“the intensified use of digital technologies in the public sector”</strong>. This perspective, while valid, only scratches the surface of the transformative scope and depth that digitalization brings across various sectors and areas of life.<br>While defining digitalization can be seen as a theoretical exercise, it is in the process of digitalization that we witness the tangible manifestations of these definitions. Understanding digitalization as <strong>the networking of all areas of the economy and society</strong> as proposed by <a href="https://www.kuchinka-partner.com/wp-content/uploads/2019/11/Digitale_Transformation_von_Geschaeftsmodellen.pdf">Daniel R. A. Schallmo</a>, necessitates examining how this intensification unfolds and affects various aspects of our lives. This leads us to delve into the process of digitalization, which encompasses the phases and shifts that accompany the adoption and integration of digital technologies.<br>The process of digitalization encompasses several critical steps, including the <strong>adoption and integration of digital technologies</strong>, <strong>fostering digital literacy</strong>, <strong>effecting cultural change</strong>, and <strong>managing the resultant data effectively</strong>. This transformation permeates various sectors and influences our <strong>economy</strong>, <strong>society</strong>, and <strong>individual lives</strong>, making digitalization a comprehensive and ongoing process.</p><h4><strong>The Impact of Digitalization on the Economy</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NV7PrfN4Bnd9fePD" /><figcaption>Photo by <a href="https://unsplash.com/@sharonmccutcheon?utm_source=medium&amp;utm_medium=referral">Alexander Grey</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Having understood the nature and process of digitalization, we now turn our attention to its practical implications, starting with its profound influence on the economic landscape.<br>Firstly, digitalization has significantly increased <strong>production </strong>and<strong> efficiency</strong> across the economy. Many mundane operations have been automated as a result of the usage of digital technologies, freeing up human resources for more complicated and creative endeavors.<br>The creation of <strong>new business models</strong> is another key influence of digitalization. Companies have used digital technologies to generate novel products and services, enter new markets, and redefine their consumer relationships.<br>Digitalization has also had a significant impact on the labor sector. On the one hand, it has resulted in the <strong>creation of new job opportunities</strong> in areas such as data analysis, cybersecurity, and software development. On the other hand, it has <strong>rendered certain jobs obsolete</strong>, prompting calls for <strong>worker </strong><a href="https://dictionary.cambridge.org/dictionary/english/reskilling"><strong>reskilling</strong></a>. This last impact can also be seen as an impact on the society or the individual.</p><h4>The Impact of Digitalization on Society</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qIU_15T7PALZ0GeX" /><figcaption>Photo by <a href="https://unsplash.com/@christopher__burns?utm_source=medium&amp;utm_medium=referral">Christopher Burns</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>After having discussed the impact of the digitalization on the economy, now we are going to have a look at the impact of it on the society.<br><strong>The creation of the </strong><a href="https://www.researchgate.net/publication/353597291_From_digital_divide_to_digital_inclusion_Challenges_for_wide-ranging_digitalization_in_Pakistan"><strong>“digital gap”</strong></a> is one of the most visible societal consequences of digitalization. This refers to the disparity between individuals who have and do not have access to digital technologies. Because people with access to technology often have better possibilities for education, employment, and social mobility, the digital divide can worsen existing social inequalities.<br>Furthermore, digitalization has altered our <strong>interactions</strong> and <strong>communication</strong> with one another. Our social lives have been altered by social networking platforms, instant messaging, and video conferencing technologies. While these innovations have permitted unprecedented connection, they have also raised <a href="https://rosdok.uni-rostock.de/file/rosdok_document_0000017076/rosdok_derivate_0000094533/Hummert_DigitalisierungAuswirkungen_2018.pdf">concerns</a> about the quality of online relationships, the influence on <strong>mental health</strong>, and the loss of face-to-face contact.</p><h4>The Impact of Digitalization on the Individual</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8Cc_LvmOau4I8TgN" /><figcaption>Photo by <a href="https://unsplash.com/@thattravelblog?utm_source=medium&amp;utm_medium=referral">Dave Weatherall</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The discussion of the impact of the digitalization on the society brings us to looking at the impact of it on an individual.<br>One of the most direct effects of digitalization on individuals is the need to <strong>learn</strong> <strong>new skills</strong>. As we covered in the societal consequences section, work marketplaces are changing and individuals must adapt. This frequently entails learning new digital abilities or honing old ones. In the digital age, <a href="https://naerjournal.ua.es/article/view/v7n2-1">lifelong learning</a> has become a fundamental component of personal and professional development.<br>Digitalization has also significantly expanded people’s<strong> access to information and services</strong>. Individuals can now access services and information from the convenience of their own homes, from online shopping to e-learning. While this increases efficiency and convenience, it also raises concerns about information overload and the dependability of online information.</p><h4>Conclusion</h4><p>To summarize, the digitalization process has <strong>far-reaching consequences at all levels of our existence</strong>, from our economy and society to us as people. It has generated efficiency and new business models, changed our labor markets, and emphasized the importance of ongoing skill development. However, it has also presented new issues, such as a rising <strong>digital gap</strong>, changes in our social connections, and the need to efficiently handle information. As we continue to traverse the digital age, it is apparent that understanding, adapting to, and shaping digitalization will be critical. Moving forward, it is imperative to promote ongoing research and thoughtful policymaking to ensure that the benefits of digitalization are accessible to all, rather than being limited to those with the easiest access to digital technologies.</p><p><strong>Have you experienced the impact of digitalization in your life? At Miragon, we are experts in workflow automation, helping organizations achieve digital success. Share your thoughts, experiences, and any process automation challenges you’ve faced in the comments below! Let’s continue the conversation and explore how we can simplify your workflow automation tasks together.</strong></p><h4>Connect with us</h4><ul><li><strong>Website</strong>: <a href="https://www.miragon.io/">Miragon — Workflow Automation Experts</a></li><li><strong>GitHub</strong>: <a href="https://github.com/miragon">Miragon Open Source Projects for Process Automation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8266647e5be9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/miragon/the-impact-of-digitalization-a-multifaceted-analysis-of-economy-society-and-the-individual-8266647e5be9">The Impact of Digitalization: A
Multifaceted Analysis of Economy, Society, and the Individual</a> was originally published in <a href="https://medium.com/miragon">Miragon</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reusable process building blocks]]></title>
            <link>https://medium.com/miragon/reusable-process-building-blocks-a6e9f5eed63e?source=rss-db0d46ea6585------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6e9f5eed63e</guid>
            <category><![CDATA[process-automation]]></category>
            <category><![CDATA[low-code]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[bpmn]]></category>
            <category><![CDATA[camunda]]></category>
            <dc:creator><![CDATA[Alexander Praschek]]></dc:creator>
            <pubDate>Wed, 17 Aug 2022 12:28:10 GMT</pubDate>
            <atom:updated>2022-08-17T12:31:46.650Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yxs0ZLULLuSPunXo" /><figcaption>Photo by <a href="https://unsplash.com/@lastnameeaster?utm_source=medium&amp;utm_medium=referral">La-Rel Easter</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><em>Also available in German at </em><a href="https://www.miragon.io/blog/wiederverwendbare-prozessbausteine/"><strong><em>https://miragon.io/blog/wiederverwendbare-prozessbausteine</em></strong></a></p><p>End-to-end process automation often involves integrating different applications and systems — very little takes place on a greenfield approach with no interfaces to other systems at all. Even if this is the case, reusability and low-code offer some advantages in automating processes — however, it’s crucial to pay attention to how these are implemented.</p><p>Wouldn’t it be nice to be able to use different functionalities in different processes without too much effort? This applies to basic functionalities such as sending an e-mail, generating an invoice or saving a document, as well as process-specific tasks such as reserving a specific product in a warehouse — in other words, almost all activities in a process.</p><p>Using BPMN has given us a low-code tooling and a language to talk about the flow of a process together with the business department. We have also enabled process experts to work with developers to design workflows that can be automated.</p><p>There may even be zero-code tool vendors on the market that promise automation completely without developers. However, this blog series is not about that kind of low-code or reusability.</p><blockquote>For us, low-code means that developers use standard technologies to provide functionality that can be easily reused.</blockquote><p>At the City of Munich, we defined exactly this vision statement in the DigiWF project, in which many of the concepts presented here were developed and applied. We design reusability for the business departments using open standards.</p><p>Reusable process modules are provided by developers and used in process modeling. This makes it possible to design process models more uniformly and to simplify the modeling. Creating simple processes is even possible without developers at all. Low-code through custom development — not a contradiction in this case, but our vision statement.</p><p>In this blog post, we will introduce the basic concepts and show what benefits this can bring to process modeling.</p><h3>Requirements for reusability</h3><p>What requirements do interfaces and activities have to meet so that they can be reused in different processes?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*TzIpohCOnK9U9SpJhayZCA.png" /><figcaption>Process Activity</figcaption></figure><p>An activity in the sense of BPMN is characterized by the fact that it receives data, executes logic and returns data that can be used by the further steps of the process.</p><p>To enable reusability in a process module, the interfaces need to be defined first. What data is required as input for processing and what data is provided as output to the process for further execution?</p><h4>Data access</h4><p>When automating workflows, data located in different contexts can be accessed in the corresponding interfaces:</p><ul><li>Process instance</li><li>Subprocess</li><li>Activity</li><li>…</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9-CDA9hrb0kWAwwgRj5W1A.png" /><figcaption>Data scopes in process instances</figcaption></figure><p>A task always has access to the data contained in its own and the higher-level scopes. The input/output mapping allows individual tasks to be reused in different contexts.</p><p>If an activity is to be reused in different processes, access to the data should be uniform. It is possible to make data available across processes under the same key or to access only the local data of the activity. For various reasons, it makes sense to access local variables exclusively:</p><ul><li>better and easier reusability</li><li>less error-proneness with parallel use</li><li>clear definition of the interface</li><li>versioning of the interface</li><li>no overlapping of different interfaces</li><li>data protection and security</li></ul><h4>Writing data</h4><p>The same applies to the data returned to the process after the activity has finished. Either the interface provides local data or it outputs it directly to a parent scope of the activity. In this case, the same arguments speak in favor of writing only local variables and defining a manual mapping of the provided data during modeling.</p><p>In summary, the following two rules should be followed:</p><ul><li><strong>Only local variables are accessed (Input)</strong></li><li><strong>Only local variables are written (Output)</strong></li></ul><p>If we adhere to this, we can build up a library of interfaces in the long term whose usages are not limited to a single process.</p><h3>Reusability by example</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*yk5aYrl88OVds6qAS2zGkA.png" /><figcaption>Order process</figcaption></figure><p>In this picture, you can see a part of a simplified ordering process. After we received an order, it first needs to be checked. After checking, the order confirmation and the invoice are being sent. If we take a closer look, both cases do the same: sending an e-mail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*or8JbDx_SvNfqgreGX8Tpw.png" /><figcaption>Order process</figcaption></figure><p>The functionality “Send e-mail” only requires the following data to be provided:</p><ul><li>Recipient</li><li>Text</li><li>Document</li></ul><p>This gives us a function that can be reused not only in the same process model, but also across processes.</p><h3>Coming up next</h3><p>How can we use these interfaces while modeling? In the next blog post, we will learn about the <strong>Element Templates</strong> feature of Camunda and look at how we can enable easy reuse through low-code and build a library that can be used by different processes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6e9f5eed63e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/miragon/reusable-process-building-blocks-a6e9f5eed63e">Reusable process building blocks</a> was originally published in <a href="https://medium.com/miragon">Miragon</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Conditional Testing with Cypress]]></title>
            <link>https://medium.com/miragon/conditional-testing-with-cypress-ff73721dd122?source=rss-db0d46ea6585------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff73721dd122</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[cypress]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Alexander Praschek]]></dc:creator>
            <pubDate>Mon, 22 Nov 2021 09:24:33 GMT</pubDate>
            <atom:updated>2022-05-17T10:19:44.097Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vBZrK4hXik4YKKVE" /><figcaption>Photo by <a href="https://unsplash.com/@danielkorpai?utm_source=medium&amp;utm_medium=referral">Daniel Korpai</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><em>Also available in German at </em><a href="https://www.miragon.io/blog/conditional-testing-mit-cypress/"><em>miragon.io</em></a><em>.</em></p><p>In this blog post, we’re going to talk about Cypress. If you haven’t heard of this tool yet — Cypress is a framework built for testing web applications. It runs inside your browser and enables you to manipulate and access the DOM elements. At miragon, we use it for end-to-end testing our applications inside our CI pipeline. If you are interested in Cypress, we can recommend <a href="https://docs.cypress.io/guides/overview/why-cypress">this introduction from the official documentation</a>.</p><p>When reading <a href="https://docs.cypress.io/guides/core-concepts/conditional-testing">the nicely written Cypress documentation</a>, you may notice that the authors advise against using conditional logic in your tests for good reason. Nevertheless, there are situations when conditional testing can be useful. Let’s take a closer look at one of these situations. The following example includes a small amount of conditional logic to help keep a test sequence repeatable.</p><p>Imagine an end-to-end test in which the user creates an object in the database. The second test then tries to remove this object again. But what happens if the first test failed? You can be sure that the second test will also fail! For this use case, we will show an example on how to cleanup data created by a test in a beforeEach hook.</p><p>The problem is, we don’t know if the first test worked at all before we start the second test. If we ignore this issue and try deleting the object every time, the second test will certainly fail as well if the first test did, because the table row containing the delete button simply does not exist. To prevent this, we have to restructure our tests. Instead of having dependencies on previous tests, we will make sure that every test creates everything it needs by itself. After the test, there will be a cleanup step. This way, the two tests don’t have any dependencies on each other.</p><h4>Creating the object</h4><p>To create the object, we have to fill the form and click the save button. Imagine the following UI:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*p-ONlRu54Ss4rcvmQAGWfQ.png" /><figcaption>The create object screen we’ll use</figcaption></figure><p>To fill this form and save the object, we can use the following Cypress instructions.</p><blockquote>To uniquely identify each element, we add data-cy attributes to each of the clickable elements in our applications. This is what we will be using to find the correct buttons and inputs in the following snippets.</blockquote><pre>// Click the button to open the &quot;new object&quot; screen<br>cy.get(&#39;[data-cy=button-new-object]&#39;).click()</pre><pre>// Fill the name and description input fields<br>cy.get(&#39;[data-cy=input-name] input&#39;).type(&#39;My Object&#39;)<br>cy.get(&#39;[data-cy=input-description] input&#39;).type(&#39;This is my object.&#39;)</pre><pre>// Click the save button<br>cy.get(&#39;[data-cy=button-save]&#39;).click()</pre><p>We end up with a table like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*xfmM7s1fn7NOSoYLC8gicw.png" /><figcaption>The table containing all objects.</figcaption></figure><h4>Cleaning up</h4><p>To make sure that the second test can create the element by itself, we will clean up the list in the beforeEach hook executed by Cypress before starting a test. We will iterate over each table row, will check if the element has the same name as the row we’re looking for and if so, attempt to delete it. The command will be executed for each row in the table, but we only click the delete button if the row contains the text we’re looking for. That way, it will never fail, regardless of the table content.</p><pre>// Iterate over each row in the table<br>cy.get(&#39;[data-cy=table-container] &gt; table &gt; tbody tr&#39;).each($row =&gt; {<br>    // If the row has the same name as the object we&#39;re looking for<br>    if ($row.text().includes(&#39;My Object&#39;)) {<br>        // Click the delete button...<br>        cy.get(&#39;[data-cy=delete-object-MyObject]&#39;)<br>            .click()<br>            // ...and accept the popup dialog<br>            .get(&#39;[data-cy=delete-dialog-button-delete]&#39;)<br>            .click()<br>        // Wait until the object has been removed<br>        cy.get(`[data-cy=delete-object-MyObject]`)<br>          .should(&#39;not.exist&#39;)<br>    }<br>})</pre><blockquote>As mentioned before, we’re adding a data-cy attribute to each element. However, in table rows and lists you have to make sure that each row has its own ids. We do that by generating a predictable and unique id using the content of the row or list item. We may talk about this in detail in a future blog post.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff73721dd122" width="1" height="1" alt=""><hr><p><a href="https://medium.com/miragon/conditional-testing-with-cypress-ff73721dd122">Conditional Testing with Cypress</a> was originally published in <a href="https://medium.com/miragon">Miragon</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Generating Client APIs using Swagger Part 3]]></title>
            <link>https://medium.com/miragon/generating-client-apis-using-swagger-part-3-cef6d7e6767?source=rss-db0d46ea6585------2</link>
            <guid isPermaLink="false">https://medium.com/p/cef6d7e6767</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[auth0]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Alexander Praschek]]></dc:creator>
            <pubDate>Tue, 12 Oct 2021 13:25:29 GMT</pubDate>
            <atom:updated>2022-05-17T10:19:20.529Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Also available in German at </em><a href="https://www.miragon.io/blog/generierung-von-client-apis-mit-swagger-teil-3/"><em>miragon.io</em></a><em>.</em></p><p>With each new backend release a frontend developer has to rewrite huge parts of the API client. What if there would be a solution to update the whole client in just a few seconds?</p><p>In this blog post, we’re introducing Swagger’s client generation, showing how to use the generated API in React applications and pointing out how to integrate Auth0’s authentication token.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*4lftm1YUSmwJOJDiyUYwog.png" /></figure><p>To keep things simple, this topic will be divided into a series consisting of three parts:</p><ol><li>Generating Client APIs using Swagger Part 1: Integrating Swagger into Spring Boot, generating the API client and using it as part of a React web app</li><li>Generating Client APIs using Swagger Part 2: Securing the endpoints using Auth0 and authorising the web client’s requests</li><li>Generating Client APIs using Swagger Part 3: Using the generated API client as part of a React Native App.</li></ol><h3>Using the generated API client as part of a React Native app</h3><p>In the final part of this series we’ll integrate our Swagger client API in a React Native app. This section builds on top of the two previous blog posts, so please work through them, before you start reading this one. Today’s goal is to implement a React Native app presenting the projects that we manage in our React web application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JLndxFFhR-D1v-CgU5DI_g.png" /></figure><h4>tl;dr</h4><p>Due to the higher configuration effort you have to go through with this post, a tl;dr does not work for this. For a quick-start, walk through Step 1 and 2 and use our <a href="https://github.com/FlowSquad/code-examples/tree/main/projects/miragon-example-app">example-app</a>.</p><h4>Step 1) Get an Expo account</h4><p>Expo is a wrapper for React Native apps, which simplifies the whole development process including dependency management, build and deployment.</p><ol><li>Visit <a href="https://expo.io/">https://expo.io/</a> and create a new account.</li><li><a href="https://docs.expo.dev/get-started/installation/">Install the Expo CLI tool</a>.</li><li>Create a new project by executing expo init in an empty directory.</li><li>Publish the project to Expo via expo publish → this should generate a project page similar to ours: <a href="https://expo.io/@miragon/miragon-example-app">https://expo.io/@miragon/miragon-example-app</a></li></ol><h4>Step 2) Creating and configuring an Auth0 application</h4><ol><li>In Auth0, create a new native application for your existing tenant: Applications → Create Application → Native</li><li>Add your Expo project’s authentication URL to the list of allowed callback URLs (e.g. <a href="https://auth.expo.io/@miragon/miragon-example-app">https://auth.expo.io/@miragon/miragon-example-app</a>) and save the changes pressing the button at the bottom.</li><li>Set the tenant’s default directory to Username-Password-Authentication: Go to the tenant’s settings (same level as your application) → General → Set API Authorization Settings to “Username-Password-Authentication”.</li></ol><h4>Step 3) Configure the React Native App</h4><p>If you’d like to try authentication on a working example, clone our <a href="https://github.com/FlowSquad/code-examples/tree/main/projects/miragon-example-app">example-app</a>, add the following environment variables to your run configuration and start the app using expo start:</p><pre>AUTH0_DOMAIN=&lt;YOUR_DOMAIN&gt; (e.g. <a href="https://miragon-example-tenant.eu.auth0.com);/">https://miragon-example-tenant.eu.auth0.com/authoriz</a>e);<br>AUTH0_CLIENT_ID=&lt;YOUR_CLIENT_ID&gt; (e.g. yXu7nsklfU495Hgsdg51p0age9dC)</pre><p>You will see that we’re using Auth0&#39;s login flow, which forwards the user to its login page and reopens the app after entering the correct credentials. This logic is implemented in constants/Auth.tsx and works the following way:</p><p>At first, the client’s credentials are used to get an authorization code, which is a long-term token that’s valid for 30 days. This long-term token is then used to request a short-term access token in the second step. In our apps we persist this long-term token in Expo’s secure storage on the client device and use it to refresh the access token whenever it expires. That’s why our users don’t have to enter their credentials every time they reopen the app. Please refer <a href="https://jamesirish.io/blog/auth0-pkce-flow-using-expo-authsession">this article</a> to find out more about the implementation.</p><p>To keep the code free from dependencies to our specific Auth0 domain and client ID, we store them as environment variables using expo-constants in combination with the file app.config.js, which looks like this:</p><pre>import app_config from &quot;./app.json&quot;<br><br>export default  {<br>    ...app_config.expo,<br>    extra: {<br>        auth0ClientId: process.env.AUTH0_CLIENT_ID,<br>        auth0Domain: process.env.AUTH0_DOMAIN,<br>    },<br>};</pre><p>As you can see, the file app.json is extended. That’s the file in which all of Expo’s configuration is happening. To use Auth0 in your Expo app, make sure you set “owner” to your Expo account name and “scheme” to a preferably unique shortcut. It will be used as the protocol part in the redirect URLs to reopen the app after a successful login (e.g. mea://...). Check our example app.json below:</p><pre>{<br>  &quot;expo&quot;: {<br>    &quot;name&quot;: &quot;miragon-example-app&quot;,<br>    &quot;slug&quot;: &quot;miragon-example-app&quot;,<br>    &quot;scheme&quot;: &quot;mea&quot;,<br>    &quot;owner&quot;: &quot;miragon&quot;,<br>    ...<br>}</pre><p>At last you have to add the dependency react-native-polyfill/auto and import it from your App.tsx This is necessary to fix the Axios fetch issue, as described <a href="https://github.com/facebook/react-native/issues/23922">here</a>.</p><h4>Step 4) Integrate the API</h4><p>Since React Native apps are based on React, you can use the same approach that we set up for our web application in the previous part.</p><p>That’s it. Have fun working with this business-ready setup based on Spring Boot, Swagger, Auth0, React and React Native!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cef6d7e6767" width="1" height="1" alt=""><hr><p><a href="https://medium.com/miragon/generating-client-apis-using-swagger-part-3-cef6d7e6767">Generating Client APIs using Swagger Part 3</a> was originally published in <a href="https://medium.com/miragon">Miragon</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Generating Client APIs using Swagger Part 2]]></title>
            <link>https://medium.com/miragon/generating-client-apis-using-swagger-part-2-ab4a95425987?source=rss-db0d46ea6585------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab4a95425987</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[auth0]]></category>
            <category><![CDATA[swagger]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Alexander Praschek]]></dc:creator>
            <pubDate>Fri, 10 Sep 2021 11:32:17 GMT</pubDate>
            <atom:updated>2022-05-17T10:18:45.101Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Also available in German at </em><a href="https://www.miragon.io/blog/generierung-von-client-apis-mit-swagger-teil-2/"><em>miragon.io</em></a></p><p>With each new backend release a frontend developer has to rewrite huge parts of the API client. What if there would be a solution to update the whole client in just a few seconds?</p><p>In this blog post, we’re introducing Swagger’s client generation, showing how to use the generated API in React applications and pointing out how to integrate Auth0’s authentication token.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*4lftm1YUSmwJOJDiyUYwog.png" /></figure><p>To keep things simple, this topic will be divided into a series consisting of three parts:</p><ol><li>Generating Client APIs using Swagger Part 1: Integrating Swagger into Spring Boot, generating the API client and using it as part of a React web app</li><li>Generating Client APIs using Swagger Part 2: Securing the endpoints using Auth0 and authorising the web client’s requests</li><li>Generating Client APIs using Swagger Part 3: Using the generated API client as part of a React Native App.</li></ol><h3>Securing the endpoints using Auth0 and authorising the web clients’ requests</h3><p>In this second part of our blog post series, we’re securing our web app with OAuth2 using Auth0. Auth0 describes itself as “an easy to implement, adaptable authentication and authorization platform”, offering a free plan for up to 7000 users. This post will cover the integration of Auth0 in your Spring Boot backend and your React web application.</p><p><strong>tl;dr</strong></p><ol><li>Create a new tenant in Auth0, as described in Step 1.</li><li>Clone our <a href="https://github.com/FlowSquad/code-examples/tree/main/projects/miragon-example-backend">example-backend</a> and start the Docker services.</li><li>In src/main/resources/application.properties, set the value spring.security.oauth2.resourceserver.jwt.issuer-uri=&lt;AUTH0_TENANT_DOMAIN&gt; to use your Auth0 Test Tenant.</li><li>Start the backend <strong>without</strong> no-securityprofile.</li><li>Clone our <a href="https://github.com/FlowSquad/code-examples/tree/main/projects/miragon-example-webapp-secured">example-webapp-secured</a>, install all dependencies using yarn install.</li><li>Set the following environment variables in the webapp’s run configuration:</li></ol><pre>REACT_APP_DOMAIN=&lt;YOUR_DOMAIN&gt; (e.g.: https://miragon-example-tenant.eu.auth0.com);<br>REACT_APP_CLIENT_ID=&lt;YOUR_CLIENT_ID&gt; (e.g.: yXu7adklfU729Hgsdg93p0gag9dC);</pre><p>7. Start the application using yarn start.</p><h4>Step 1) Get an Auth0 Account, create a new Tenant and a new Application</h4><ol><li>Visit Auth0 and create a new account: <a href="https://auth0.com/">https://auth0.com/</a>.</li><li>Create a new Tenant: Click on your default tenant and select “Create Tenant”.</li><li>Create a new Application: Applications → “Create Application” → “Single Web Page Applications”.</li><li>Configure your Application: Change the name and set “Allowed Callback URLs” as well as “Allowed Web Origins” to “<a href="http://localhost:8080/">http://localhost:8080/</a>” and <strong>save the changes</strong> (find the save button at the form’s bottom”).</li></ol><p>5. Create a user: User Management → Users → Create User</p><h4>Step 2) Secure Backend Application</h4><p>In src/main/resources/application.properties, set the value spring.security.oauth2.resourceserver.jwt.issuer-uri=&lt;AUTH0_TENANT_DOMAIN&gt; to use your Auth0 Tenant. It can be found on the application page in Auth0.</p><p>You can secure your Backend using the following security configuration (find this class in <a href="https://github.com/FlowSquad/code-examples/tree/main/projects/miragon-example-backend">example-backend</a> in the folder shared/security):</p><pre>@Profile(&quot;!no-security&quot;)<br>@EnableWebSecurity<br>@RequiredArgsConstructor<br>public class SecurityConfig extends WebSecurityConfigurerAdapter {<br><br>    @Override<br>    public void configure(final HttpSecurity http) throws Exception {<br><br>        http.authorizeRequests()<br>                .antMatchers(&quot;/actuator/health&quot;).permitAll()<br>                .antMatchers(&quot;/v3/api-docs/**&quot;,<br>                        &quot;/swagger-resources&quot;,<br>                        &quot;/swagger-resources/**&quot;,<br>                        &quot;/configuration/ui&quot;,<br>                        &quot;/configuration/security&quot;,<br>                        &quot;/swagger-ui.html&quot;,<br>                        &quot;/swagger-ui/**&quot;,<br>                        &quot;/webjars/**&quot;).permitAll()<br>                .anyRequest()<br>                .authenticated()<br>                .and()<br>                .oauth2ResourceServer(<br>                        OAuth2ResourceServerConfigurer::jwt<br>                );<br><br>        http.headers().frameOptions().sameOrigin();<br>        http.csrf().disable();<br>        http.sessionManagement()<br>                .sessionCreationPolicy(<br>                        SessionCreationPolicy.<em>STATELESS<br>                </em>);<br>    }<br><br>    @Bean<br>    public JwtDecoder jwtDecoderByIssuerUri(<br>        final OAuth2ResourceServerProperties properties<br>    ) {<br>        final String issuerUri = properties.getJwt().getIssuerUri();<br>        return JwtDecoders.<em>fromIssuerLocation</em>(issuerUri);<br>    }<br>}</pre><h4>Step 3) Secure Web App</h4><p>We’ll use Auth0&#39;s Username &amp; Password Authentication, which should pop up if the user is not authenticated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MffvRO31wl5gjN4FeApm3Q.png" /></figure><p><strong>3a) Adding Auth0 Provider</strong></p><p>Install the required dependency via yarn add @auth0/auth0-react and wrap the provider around your application (<em>index.tsx</em>):</p><pre>&lt;Auth0Provider<br>    domain={process.env.REACT_APP_DOMAIN ?? &quot;&quot;}<br>    clientId={process.env.REACT_APP_CLIENT_ID ?? &quot;&quot;}<br>    authorizeTimeoutSeconds={5}<br>    useRefreshTokensIn<br>    redirectUri={window.location.origin}&gt;<br>    &lt;HashRouter&gt;<br>        &lt;App/&gt;<br>    &lt;/HashRouter&gt;<br>&lt;/Auth0Provider&gt;</pre><p>Find the domain and the client ID in the Auth0 application you created above.</p><p><strong>3b) Storing the token in Local Browser Storage:</strong></p><p>If the user has logged in successfully, we can now store the JWT token in the browser storage to access it from every page independently (<em>src/components/Layout/Layout.tsx</em>):</p><pre>(async () =&gt; {<br>    const token = await getIdTokenClaims();<br>    localStorage.setItem(&quot;token&quot;, token.__raw)<br>})();</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7q3bQLUK6YSeoTPnfDTMhw.png" /><figcaption>The token in the application’s local storage</figcaption></figure><p><strong>3c) Configure the generated Swagger API</strong></p><p>Use the Configuration class to set the Authentication Header (<em>src/constants/Functions.tsx</em>):</p><pre>getClientConfig: function (): Configuration {<br>    return new Configuration({<br>        baseOptions: {<br>            &quot;headers&quot;: {<br>                &#39;Authorization&#39;: `Bearer ${this.getBearerToken()}`,<br>            }<br>        }<br>    })<br>},<br>getBearerToken: function (): string | null {<br>    return localStorage.getItem(&quot;token&quot;);<br>}</pre><p><strong>3d) Set the Configuration when creating an API Client</strong></p><p>With this configuration, you can start sending authenticated requests to the secured endpoints of your backend:</p><pre>const config = getClientConfig();<br>const projectController = new ProjectControllerApi(config)<br>const response = await projectController.getAllProject()<br>const data = response.data</pre><p>In the third — and last — part of this series, we will have a closer look at how to use the generated API client as part of a React Native App. Stay tuned for part 3!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab4a95425987" width="1" height="1" alt=""><hr><p><a href="https://medium.com/miragon/generating-client-apis-using-swagger-part-2-ab4a95425987">Generating Client APIs using Swagger Part 2</a> was originally published in <a href="https://medium.com/miragon">Miragon</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Generating Client APIs using Swagger Part 1]]></title>
            <link>https://medium.com/miragon/generating-client-apis-using-swagger-part-1-2d46f13f5e92?source=rss-db0d46ea6585------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d46f13f5e92</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[client-generation]]></category>
            <category><![CDATA[swagger]]></category>
            <dc:creator><![CDATA[Alexander Praschek]]></dc:creator>
            <pubDate>Fri, 20 Aug 2021 08:10:47 GMT</pubDate>
            <atom:updated>2022-05-17T10:18:20.082Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Also available in German at </em><a href="https://www.miragon.io/blog/generierung-von-client-apis-mit-swagger-teil-1/"><em>miragon.io</em></a></p><p>With each new backend release a frontend developer has to rewrite huge parts of the API client. What if there would be a solution to update the whole client in just a few seconds?</p><p>In this blog post, we&#39;re introducing Swagger’s client generation, showing how to use the generated API in React applications and pointing out how to integrate Auth0&#39;s authentication token.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*4lftm1YUSmwJOJDiyUYwog.png" /></figure><p>To keep things simple, this topic will be divided into a series consisting of three parts:</p><ol><li>Generating Client APIs using Swagger Part 1: Integrating Swagger into Spring Boot, generating the API client and using it as part of a React web app</li><li>Generating Client APIs using Swagger Part 2: Securing the endpoints using Auth0 and authorising the web client’s requests</li><li>Generating Client APIs using Swagger Part 3: Using the generated API client as part of a React Native App.</li></ol><h3>Integrating Swagger in Spring Boot and generating the client</h3><p>The goal of this section is to generate the API documentation of a Java Spring Boot application using Swagger, create the according TypeScript Axios Client, which encapsulates the API calls, and integrate this client into a React web app. The result will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*8RpKI4K6bjKi7ZRuXVeWhA.png" /></figure><p><strong>tl;dr</strong></p><ol><li>Clone our <a href="https://github.com/FlowSquad/code-examples/tree/main/projects/miragon-example-backend">example-backend</a>, start Docker and run the application using the Spring Boot no-security profile.</li><li>Clone our <a href="https://github.com/FlowSquad/code-examples/tree/main/projects/miragon-example-webapp">example-webapp</a>, install all dependencies using yarn install and run yarn generate-api in the project’s root</li></ol><h4>Step 1) Integrate Swagger into Spring Boot</h4><p>All code snippets are part of our <a href="https://github.com/FlowSquad/code-examples/tree/main/projects/miragon-example-backend">example-backend</a>. This backend application allows managing projects, which represent an object containing the customer’s name and their address. Using the API endpoints, a client is able to create, read, update, and delete (CRUD) projects.</p><p><strong>1a) Annotate the controllers and add information about each endpoint</strong></p><p>After adding the springdoc-openapi-ui dependency to the dependency management file (e.g. build.gradle or pom.xml), you’ll be able use<strong> its annotations</strong> for the projects controllers.</p><pre>@Slf4j<br>@Validated<br>@RestController<br>@RequiredArgsConstructor<br><strong>@Tag(name = &quot;Project Controller&quot;)</strong><br>@RequestMapping(&quot;/api/project&quot;)<br>public class ProjectController {<br><br>    private final ProjectService projectService;<br>    private final ProjectApiMapper projectMapper;<br><br>    @Transactional(readOnly = true)<br>    @GetMapping<br>    <strong>@Operation(summary = &quot;Get list of all projects&quot;)</strong><br>    public ResponseEntity&lt;List&lt;ProjectTO&gt;&gt; getAllProject() {<br>        <em>log</em>.debug(&quot;Received request to load all projects&quot;);<br>        final List&lt;Project&gt; allProjects = this.projectService.getAllProjects();<br>        return ResponseEntity.<em>ok</em>(this.projectMapper.mapToTO(allProjects));<br>    }</pre><pre>...</pre><p><strong>1b) Visit the generated API documentation</strong></p><ol><li>As described in the project’s README, both Docker services (nginx and postgres) have to run until you can start the example backend.</li><li>Please make sure that you’ve enabled the no-security profile in the run configurations: <br>IntelliJ → Run → Edit Configurations… → Active profiles: no-security</li><li>Now you should be able open the API documentation in your browser: http://localhost:8081/swagger-ui.html</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fvHsHrfWvei3JL17nRpdSw.png" /><figcaption>API documentation of our example project</figcaption></figure><h4>Step 2) Generate the API Client</h4><p>There are several ways to generate an API client using Swagger: You could use a Gradle or Maven plugin, use Swagger Editor or use a third-party JavaScript library. In our opinion, generating the client API should not be part of the backend. That’s why we went with the Swagger Editor in the first place and later switched to the openapi-generator-cli later on to have the benefit of strongly typed interfaces. In this section, we’ll explain both ways, using Swagger Editor and openapi-generator-cli:</p><p><strong>a) Swagger Editor</strong></p><ol><li>Open the URL http://localhost:8081/v3/api-docs and copy everything.</li><li>Visit Swagger Editor (<a href="https://editor.swagger.io/">https://editor.swagger.io/</a>) and paste it into the editor window → you will be asked if you want to convert it to .yaml → Accept.</li><li>In the menu of Swagger Editor, you’ll find the “Generate Client” dropdown. Select “TypeScript Axios”, and wait until the download has finished.</li><li>Unzip it, copy api.ts, base.ts, configuration.ts, apis-folder, and models-folder into a new folder in your frontend project.</li></ol><p><strong>b) Openapi-Generator-Cli</strong></p><ol><li>Download and add @openapitools/openapi-generator-cli<em> </em>as dev-dependency in your webapp using the following command: <br>yarn add --dev @openapitools/openapi-generator-cli</li><li>Make sure that your backend is up and running.</li><li>Run the following command:</li></ol><pre>yarn openapi-generator-cli generate \<br>    -i <a href="http://localhost:8081/v3/api-docs">http://localhost:8081/v3/api-docs</a> \<br>    -g typescript-axios \<br>    -o src/api</pre><p><strong>Optional</strong>: Delete the files .npmignore, .gitignore, and git_push.sh, and add them to the file .openapi-generator-igonre<em>. A</em>dd openapitools.json, and /src/api/.openapi-generator to your project’s .gitignore.</p><h4><strong>Step 3) Using the API Client in a React Web Application</strong></h4><p>To work with the generated API using an nginx as reverse proxy, you first have to set the BASE_PATH variable in src/api/base.ts to an empty string:</p><pre>export const <strong><em>BASE_PATH </em></strong>= &quot;&quot;;</pre><p>Now you can fetch data from the API endpoint with just three lines of code:</p><pre>const projectController = new ProjectControllerApi()<br>const response = await projectController.getAllProject()<br>const data = response.data</pre><p>In our <a href="https://github.com/FlowSquad/code-examples/tree/main/projects/miragon-example-webapp">example-webapp</a>, we encapsulated the all api-calls within a helper method to catch the errors. Additionally we’re using redux-store to cache the received data, which allows us to reduce the backend calls.</p><p>In the next part of this series, we will see how to secure the endpoints using Auth0 and authorize the web client’s requests. Stay tuned for part 2!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d46f13f5e92" width="1" height="1" alt=""><hr><p><a href="https://medium.com/miragon/generating-client-apis-using-swagger-part-1-2d46f13f5e92">Generating Client APIs using Swagger Part 1</a> was originally published in <a href="https://medium.com/miragon">Miragon</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Docker images with GitHub Actions and Google Cloud]]></title>
            <link>https://medium.com/miragon/building-docker-images-with-github-actions-and-google-cloud-b8894e0edff0?source=rss-db0d46ea6585------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8894e0edff0</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[cicd]]></category>
            <dc:creator><![CDATA[Alexander Praschek]]></dc:creator>
            <pubDate>Tue, 27 Jul 2021 14:18:13 GMT</pubDate>
            <atom:updated>2022-05-17T10:17:45.343Z</atom:updated>
            <content:encoded><![CDATA[<h4>Building Docker images with Google Cloud Build and pushing them to Google Cloud Registry using GitHub Actions as part of your CI pipeline.</h4><p><em>Also available in German at </em><a href="https://www.miragon.io/blog/docker-images-mit-github-actions-und-google-cloud-bauen/"><em>miragon.io</em></a><em>.</em></p><p>In the last parts of our GitHub Actions blog series, we took a closer look at Gradle builds. But deploying to the cloud usually involves using pre-built Docker images, not JAR files. How can we build these as part of our CI pipeline?</p><p>For this purpose, we have developed the GitHub action docker-cloud-build and made it available <a href="https://github.com/flowsquad/docker-cloud-build">open source in our GitHub repository</a>. Using this action, a finished Docker image can be built in just one step as a result of a Dockerfile and a list of input files, and is then available in Google Cloud Registry.</p><p>Furthermore, the build output can be displayed in the GitHub UI to see at a glance which tags were created and if the build was successful.</p><h3>Getting Started</h3><p>To use the action, we first need to add a new step to our action.yaml file. It will look like this, for example:</p><pre>- name: Build Docker Image<br>  uses: FlowSquad/docker-cloud-build@v1.0.1<br>  with:<br>    gcp-project-id: my-project-id<br>    gcp-service-account-key: ${{ secrets.GCP_SA_KEY }}<br>    image-name: my-image-name<br>    image-sources: build/libs/*.jar,Dockerfile,some-other-file<br>    github-token: ${{ secrets.GITHUB_TOKEN }}</pre><p>The configuration above is the minimal possible configuration. The available parameters can be used to extensively customize the behavior of the action. The parameter gcp-project-id contains the ID of the project in Google Cloud that is supposed to be used. The default region for Google Cloud Registry is eu.gcr.io. This can be customized with the gcp-gcr-region parameter.</p><p>You can specify the name of the image under image-name. The tag is then created dynamically. The files required for the build are specified as image-sources. All files and folders from the GitHub actions workspace can be specified. Wildcards such as * or ? are also supported. The files then need to be copied into the finished image within the Dockerfile.</p><h3>Authentication</h3><p>Under gcp-service-account-token a base64 encoded service account JSON file must be specified. This will be used for authenticating with GCP. The service account requires the following permissions:</p><pre>cloudbuild.builds.create   # Required to start cloud builds<br>cloudbuild.builds.get      # Required to check build status<br>storage.objects.create     # Required to upload build input data<br>storage.objects.get        # ^ same<br>storage.objects.list       # ^ same<br>storage.objects.delete     # Required to clean up after build</pre><p>The required JSON file can be created in Google Cloud IAM under Service Accounts. To do this, select the desired service account, switch to the Keys tab, and create a new key of type JSON.</p><h3>GitHub Integration</h3><p>The github-token is only required if the github-disabled parameter is not set to true. Typically, the default token provided by GitHub Actions is sufficient for this. It is necessary to set the commit status and/or the release notes. More on this later.</p><p>Before we can run the action, we first need to create a bucket in Google Cloud Storage to cache the input files for the build. By default, a bucket named ${projectId}_cloudbuild is used for this purpose. The name can be overridden with the gcp-cloud-storage-bucket parameter.</p><p>If you run the action now, the corresponding image will be built and tagged as $branch-$commitSha-$yyyy.$mm.$dd-$hh.$mm.$ss by default. The first part is the (normalized) branch name, the second part is the 7-character short hash of the commit used, and the third part is the date and time of the build.</p><p>If the action is triggered by a new tag being created in GitHub, the tag name is also set as an image tag. The <a href="https://github.com/FlowSquad/docker-cloud-build#tagging-the-image">available parameters</a> can be used to customize the tags used. For example, the default tag can always be set globally or for the corresponding branch, or the format of the default tag can be changed. Custom tags are also possible.</p><p>If desired, the built image tags can then be displayed as commit status in GitHub. This makes it clear at a glance with which name the image can be retrieved. The format of the <a href="https://github.com/FlowSquad/docker-cloud-build#github-commit-status">message can also be customized</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*3WF_6gNBq9N35mKBxArinw.png" /><figcaption>Displaying docker image tags as commit status</figcaption></figure><p>If the action is triggered by a newly created release, the built tags can also be added to the corresponding release notes. This can make it easier for users of the image to find the relevant links. Whether only the default tag or all tags should be included in the release notes can be <a href="https://github.com/FlowSquad/docker-cloud-build#github-release-information">customized</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*MzSrG5UpJnta1g9panTurA.png" /><figcaption>Automatically added docker image tags in the GitHub release notes page</figcaption></figure><p>All available parameters and more information can be found <a href="https://github.com/FlowSquad/docker-cloud-build">here</a>. We use this action across the board in our build pipelines to build Docker images for frontend, backend, and other applications that are then used in our Kubernetes clusters. To deploy them, we use the GitOps approach. More on this in a future blog post!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8894e0edff0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/miragon/building-docker-images-with-github-actions-and-google-cloud-b8894e0edff0">Building Docker images with GitHub Actions and Google Cloud</a> was originally published in <a href="https://medium.com/miragon">Miragon</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DevOps with GitHub — Part 2: Building and Publishing Packages with GitHub Actions]]></title>
            <link>https://medium.com/swlh/devops-with-github-part-2-building-and-publishing-packages-with-github-actions-3bbe232066ad?source=rss-db0d46ea6585------2</link>
            <guid isPermaLink="false">https://medium.com/p/3bbe232066ad</guid>
            <category><![CDATA[github-package]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[gradle]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Alexander Praschek]]></dc:creator>
            <pubDate>Wed, 02 Sep 2020 12:42:57 GMT</pubDate>
            <atom:updated>2022-05-17T10:16:57.604Z</atom:updated>
            <content:encoded><![CDATA[<h3>DevOps with GitHub — Part 2: Building and Publishing Packages with GitHub Actions</h3><h4>In the second part of this series, we’ll look at how we can use GitHub Actions as a build pipeline for our Gradle project.</h4><p><em>Originally published in German at </em><a href="https://www.miragon.io/blog/devops-mit-github-teil-2-packages-bauen-und-veroffentlichen-mit-github-actions/"><em>miragon.io</em></a><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7towPF7h0ZNjCMv_" /><figcaption>A build pipeline of the ancient Romans — Photo by <a href="https://unsplash.com/@kovacsz1?utm_source=medium&amp;utm_medium=referral">Z S</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>At the same time as GitHub Packages, GitHub Actions was announced. This service makes it possible to respond to events with different actions. Numerous different events are supported.</p><p>We have already dealt with GitHub Packages in the first part of this series. You can find it <a href="https://medium.com/swlh/devops-with-github-part-1-github-packages-with-gradle-c4253cdf7ca6">here</a>. This part builds on the project we created in the first blog post. In this part, we will add a build pipeline with GitHub Actions to it. An artifact will be built from our Gradle project, which is then published automatically in GitHub Packages on every commit.</p><h3>What is GitHub Actions?</h3><p>GitHub Actions can be described as a pipeline that executes custom actions in response to certain events. While traditional pipelines, such as Jenkins, usually only respond to new commits by performing a build, GitHub Actions is designed with a broader scope.</p><p>Even though the most used events are probably new commits and pull requests, GitHub Actions can be used to create actions that are executed when a new issue is created, and much more. All available events are listed <a href="https://docs.github.com/en/actions/reference/events-that-trigger-workflows">here</a>.</p><p>The service is free for public repositories; private repositories get 2,000 build minutes per month for free. Paid plans have more minutes included. Additional minutes can be added for a fee (<a href="https://docs.github.com/en/github/setting-up-and-managing-billing-and-payments-on-github/about-billing-for-github-actions">more</a>). Actions are usually executed in Linux containers. Actions in Windows or macOS containers are billed with factor 2, respectively 10.</p><h3>How does it work?</h3><p>A GitHub action consists of a YAML file that is stored in the project repository. It defines which steps are executed. For each event, GitHub checks to see if matching actions are defined and runs them.</p><p>In addition to simple bash commands, you can also use actions from the Marketplace to perform often needed actions, such as checking out the source code or provisioning a specific Java version.</p><p>Own actions can be defined via NodeJS and can be reused across your repositories. Alternatively, they can be published in the Marketplace and thus made available to all GitHub users.</p><h3>How can I use it in my Gradle project?</h3><p>We build on the project we already created in the last part of the series. You can find the code for it <a href="https://github.com/FlowSquad/devops-github-packages">here</a>. Alternatively, you can follow the step-by-step instructions from the <a href="https://medium.com/swlh/devops-with-github-part-1-github-packages-with-gradle-c4253cdf7ca6">previous post</a>.</p><p>In the last part, we examined how to publish the built artifacts in GitHub Packages manually. Now we’re going to combine this with GitHub Actions and have it done automatically on each commit.</p><blockquote>All code created in the following sections can also be found in this repository: <a href="https://github.com/FlowSquad/devops-github-actions">https://github.com/FlowSquad/devops-github-actions</a></blockquote><h4>Creating the action</h4><p>First, we create the folder <em>.github/workflows</em> in the root directory of our project. There we create the file <em>publish.yaml</em>. This file defines the action and looks like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/641e090e1534c0ae75be31758205e675/href">https://medium.com/media/641e090e1534c0ae75be31758205e675/href</a></iframe><p>Within this action, our source code is first checked out. Next, Java 11 is provisioned, a Gradle build is executed, and the build result is published.</p><h4>Adjusting our project</h4><p>In our project, we can remove the files <em>gradle.properties</em> in both modules. Furthermore, we have to update the <em>build.gradle</em> files:</p><ol><li>We increase the version to 1.0.1 to avoid a version conflict when publishing. This change needs to be done in both modules and the root project.</li><li>We replace the URL of the target repository so that it ends up in our new repository. This change must be made in both modules.</li><li>We also increase the version of the library dependency to 1.0.1 to use the new artifact. This change is only required in the main module.</li></ol><h4>Authenticating to GitHub Packages</h4><p>To be able to push successfully, we usually need a corresponding token, which allows us to access the target repository. However, if we publish in the same repository where we host our code, we do not need this token.</p><p>Instead, we can use the <em>$GITHUB_ACTOR</em> variable provided automatically by GitHub and the secret <em>GITHUB_TOKEN</em>. The GitHub Actor is the name of the account that has triggered the action. The GitHub token contains a temporary token that grants permissions for the current repository only.</p><h4>Publishing to a different GitHub Packages repository</h4><p>If you intend to publish to the same repository where you host your code, you can skip this step. Else, you have to overwrite the properties <em>gpr.user</em> and <em>gpr.token</em> and adjust the last step in <em>publish.yaml</em>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/679647b5f0a99f26b5ef4406b6f415e3/href">https://medium.com/media/679647b5f0a99f26b5ef4406b6f415e3/href</a></iframe><p>Next, we need to create two new secrets in the repository settings (<em>GPR_USER</em> and <em>GPR_TOKEN</em>) and store the credentials we had in the <em>gradle.properties</em> file in them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*Giu58ROas96AemWb_HaCAA.png" /><figcaption>Create these secrets in your repository settings only if you publish to a different repository</figcaption></figure><blockquote>The secrets protect the credentials against unauthorized copying, but anyone with push access to the repository can use them within their actions.</blockquote><h4>Preventing naming conflicts</h4><p>Since we want to publish to a different repository than in the last part of this series, we have to change the package name. Otherwise, GitHub will return the error <em>422 Unprocessable Entity</em>. This is because the package group and name must be unique within an organization/account.</p><p>For this reason, we add the following line in the <em>build.gradle</em> of the library module:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f30d1bb6e0f9c8d422e48e46031f250a/href">https://medium.com/media/f30d1bb6e0f9c8d422e48e46031f250a/href</a></iframe><p>We also need to rename the dependency in the main module to <em>devops-github-actions-library</em>.</p><h4>Running the action</h4><p>As soon as we commit our changes and push them to GitHub, the new action will automatically be started. To check this, we open GitHub. There we will see a small yellow dot next to our last commit message indicating that the action is currently running. When the build is complete, the result is displayed as a green checkmark or a red cross.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*g6VAvfX9pwNGtrEI0lWVew.png" /><figcaption>Our action in action (also available <a href="https://github.com/FlowSquad/devops-github-actions/runs/1055577350">in the repository</a>)</figcaption></figure><p>To see the build details, we click on Actions in our repository, select our commit and click on <em>Build &amp; Publish / build </em>on the left. The logs will be streamed live while our action is running. As soon as the build is complete, we can go to our repository’s main page to view the newly created version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*TVqI-jCSplG9Ih-5x3Iuww.png" /><figcaption>It worked! (see <a href="https://github.com/FlowSquad/devops-github-actions/packages">here</a>)</figcaption></figure><h3>Conclusion</h3><p>In this part of the series, we looked at building and publishing a Gradle project using GitHub Actions. In the next part, we’ll try building a docker image in GitHub Actions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3bbe232066ad" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/devops-with-github-part-2-building-and-publishing-packages-with-github-actions-3bbe232066ad">DevOps with GitHub — Part 2: Building and Publishing Packages with GitHub Actions</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Get More Done In Less Time]]></title>
            <link>https://medium.com/miragon/get-more-done-in-less-time-d725ade72a8?source=rss-db0d46ea6585------2</link>
            <guid isPermaLink="false">https://medium.com/p/d725ade72a8</guid>
            <category><![CDATA[collaboration]]></category>
            <category><![CDATA[management]]></category>
            <category><![CDATA[tools]]></category>
            <category><![CDATA[efficiency]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Alexander Praschek]]></dc:creator>
            <pubDate>Mon, 08 Jun 2020 12:31:50 GMT</pubDate>
            <atom:updated>2022-05-17T10:16:14.102Z</atom:updated>
            <content:encoded><![CDATA[<h4>Big challenges — little time: How we managed to work more efficiently by using the right tools.</h4><p><em>Originally published in German at </em><a href="https://www.miragon.io/blog/mehr-in-weniger-zeit-mit-den-richtigen-tools/"><em>miragon.io</em></a><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KsAhN7Bh1qalartZ" /><figcaption>Photo by <a href="https://unsplash.com/@markuswinkler?utm_source=medium&amp;utm_medium=referral">Markus Winkler</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Before founding our company, we all worked in various other companies. However, they all had one thing in common: the internal workflows were slow and complicated, countless emails and phone calls were required for each request, and for every problem, there were at least two different tools.</p><p>Such an environment prevents efficient working, which is essential for survival, especially in small companies and start-ups. For this reason, we have been testing a lot of different tools over the past few months. By now, we found a very delightful combination.</p><p>In this blog post, we will go into more detail about which tools we use for what purpose. We made a clear decision to use only hosted applications because we want to focus our limited resources on our core business and not waste our time installing and configuring software.</p><h3>Collaboration</h3><p>Although many people have an aversion against Microsoft, from our point of view, it is indisputable that <strong>Office 365</strong> is a perfect solution at a low price. In addition to the well-known tools Word, Excel, PowerPoint, and Outlook, it also includes hosted email accounts and sufficient cloud storage.</p><h3>Communication</h3><p>In addition to the previously mentioned applications, Office 365 also includes <strong>Microsoft Teams</strong>. It enables convenient instant messaging, telephone, and video conferences. Due to the integration in Outlook, it takes only one click to attach a meeting to an appointment. It is available on all major platforms and also offers the possibility of integrating numerous third-party tools. Besides, any web application can be included, which enabled us to make our time tracking software accessible with just one click.</p><h3>Note-Taking</h3><p>Until recently, our notes were usually spread across many different places. One Word document here, a notepad there, and a simple text document somewhere else. Although there are certainly plenty of great note-taking apps out there, we decided to use <strong>OneNote</strong>. It is also available cross-platform and allows reading and editing individual pages together.</p><h3>Task management</h3><p>There are a lot of apps for collecting, assigning, and tracking tasks. We eventually decided to use <strong>Microsoft To Do</strong>, the successor to the much-praised Wunderlist. It offers shared task lists, assignments, and due dates. Various automatic task collections exist as well. However, we only use a small portion of the features.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xMuDyuHNARNajagj" /><figcaption>Photo by <a href="https://unsplash.com/@esteejanssens?utm_source=medium&amp;utm_medium=referral">Estée Janssens</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>We use a variation of the <strong>Eisenhower principle</strong> in combination with time blocking for this purpose. We put new tasks on the shared list “<em>Uncategorized</em>”. We go over this list regularly, determine which tasks have to be completed by which deadline and who will handle them. Then they either end up in the “<em>Delegated</em>” list if someone else is taking care of them or in the “<em>Scheduled</em>” list, in which case we reserve a fixed block in the calendar for the task. When the task is done, it is checked off and disappears.</p><h3>Time tracking</h3><p>To track our working times, we use <strong>Clockify</strong>. It offers the possibility to create clients, projects, and individual tasks, which allows us to track how we spend our time very well. You also get an excellent overview of your working hours. The possibility to create reports, which we use for invoicing our services, is also worth mentioning. Clockify is very affordable at $10 or $30 per month for unlimited users.</p><h3>Invoicing And Accounting</h3><p>We use <strong>Debitoor</strong> to create invoices and record our expenses. It is a simple solution to categorize your expenses and generate reports. You can also create invoices quickly, and the integration of the company’s bank account ensures that you’ll never forget any fees again. The tax consultant gets access to your data so that all invoices only have to be processed once.</p><h3>Cashflow Forecasting</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aWN7nbY2PNVSRuwl" /><figcaption>Photo by <a href="https://unsplash.com/@kmuza?utm_source=medium&amp;utm_medium=referral">Carlos Muza</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Cashflow is crucial for small businesses. Pending payments from customers are worthless if your account is drained, and you cannot pay your employees’ wages. To avoid such scenarios, we use <strong>Commitly</strong>. It allows simple cashflow planning based on the actual cashflow. The individual transactions can be categorized, and projected income and expenses can be recorded, including the due date. Based on this data, the system automatically generates plans that predict the account balance daily.</p><h3>Password Manager</h3><p>You can regularly read about data breaches and password leaks in the press. With the large number of accounts needed today, it is impossible to have a robust and unique password for every account and to remember each one. Instead, at some point, you’ll start reusing the same password or choose weak ones.</p><p>To avoid that, we use <strong>1Password</strong> as a password manager. It is available for all major platforms and browsers and offers lots of features at a low price. Every user also receives a family license for private use free of charge. Besides your private safe, there is a shared safe you can use to share single passwords with certain people and groups easily. Besides, the integration with the various login forms works exceptionally well.</p><h3>Source Code Management</h3><p>We chose <strong>GitHub</strong> to host our source code. In addition to just hosting the code, it offers excellent ways to track requests and their implementation through GitHub Issues and Projects. You can also share access to individual boards with external clients.</p><p>Additionally, GitHub offers a way to define pipelines with Actions, which, for example, automatically build and publish new builds once you push a new commit. <a href="https://medium.com/swlh/devops-with-github-part-1-github-packages-with-gradle-c4253cdf7ca6">With GitHub Packages, there is a free repository for Maven, NPM, etc. that you can use for hosting private packages</a>. However, we use DockerHub for hosting Docker images, since GitHub Packages only provides limited storage for free.</p><h3>IDE</h3><p>At the start, we used eclipse and Visual Studio Code for coding. However, we repeatedly had problems with different features. It may have been due to our lack of expertise, but as mentioned before, we don’t want to deal with such issues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*L4GumT22y1A-LlVj" /><figcaption>Photo by <a href="https://unsplash.com/@yancymin?utm_source=medium&amp;utm_medium=referral">Yancy Min</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>That’s why we eventually decided to use JetBrains IDEs. Even though eclipse and VS Code certainly offer most of the features as well, with <strong>IntelliJ and WebStorm</strong>, they work out of the box. Although the software is relatively expensive, we think it is worth it if you consider the time saved. Also, start-up companies receive a 50% discount on the regular price.</p><h3>Conclusion</h3><p>We have tried lots of different tools over the past few months. The list above contains the ones we are using right now. They allow us to work efficiently without sacrificing comfort. We are pleased with our choice, and we can only recommend them to everyone, even though there are undoubtedly good alternatives for every application.</p><p>This list will inevitably change and grow over time. New tools will be added and previously used ones removed. If there are significant changes, we will keep you updated with a new blog post. See you next time!</p><p><em>Originally published in German at </em><a href="https://www.miragon.io/blog/mehr-in-weniger-zeit-mit-den-richtigen-tools/"><em>miragon.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d725ade72a8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/miragon/get-more-done-in-less-time-d725ade72a8">Get More Done In Less Time</a> was originally published in <a href="https://medium.com/miragon">Miragon</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DevOps with GitHub — Part 1: GitHub Packages with Gradle]]></title>
            <link>https://medium.com/swlh/devops-with-github-part-1-github-packages-with-gradle-c4253cdf7ca6?source=rss-db0d46ea6585------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4253cdf7ca6</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[gradle]]></category>
            <category><![CDATA[pipeline]]></category>
            <category><![CDATA[devops-tool]]></category>
            <dc:creator><![CDATA[Alexander Praschek]]></dc:creator>
            <pubDate>Fri, 29 May 2020 17:23:26 GMT</pubDate>
            <atom:updated>2022-05-17T10:15:27.503Z</atom:updated>
            <content:encoded><![CDATA[<h3>DevOps with GitHub — Part 1: GitHub Packages with Gradle</h3><h4>In the first part of this series, we will find out how you can use GitHub Packages in your Gradle projects as your private package registry.</h4><p><em>Originally published in German at </em><a href="https://www.miragon.io/blog/devops-mit-github-teil-1-github-packages-mit-gradle/"><em>miragon.io</em></a><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iGXFPv45_ZTWlhOC" /><figcaption>Photo by <a href="https://unsplash.com/@chuttersnap?utm_source=medium&amp;utm_medium=referral">chuttersnap</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Almost exactly a year ago, GitHub announced the beta for its newest product — <strong>GitHub Package Registry</strong>. It was to become the central repository for artifacts created from code already hosted by GitHub. In addition to npm, it should support Docker, Maven, NuGet, and RubyGems.</p><p>It is yet another building block in GitHub’s strategy to support the entire journey from writing code to shipping it. At the same time, GitHub Actions was announced, which we will deal with in the next part of the series.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*9eXONC9RU8FArmaUZaHgbw.png" /><figcaption>Photo by <a href="https://unsplash.com/@karlp?utm_source=medium&amp;utm_medium=referral">Karl Pawlowicz</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In the meantime, the product has been renamed to GitHub Packages, and the beta phase has ended. In this blog post, we’ll take a first look at how GitHub Packages works in combination with Gradle.</p><h3>What is GitHub Packages?</h3><p>While most artifacts are available from MavenCentral, many large organizations have also established in-house package registries that contain their proprietary libraries.</p><p>GitHub Packages offers precisely that, with providing a package registry for each GitHub account, allowing each of your repositories to serve as a registry for artifacts as well.</p><p>The service is free for public repositories, and private repositories get 500MB of storage and 1GB of traffic per month for free. Paid plans include higher quotas. Additional storage and traffic can be purchased (<a href="https://help.github.com/en/github/setting-up-and-managing-billing-and-payments-on-github/about-billing-for-github-packages">more</a>).</p><h3>How can I use it in my Gradle project?</h3><p>In the next sections, we will create a new Gradle multi-module project step by step and integrate GitHub Packages. We are using IntelliJ, but eclipse should provide comparable functionality.</p><blockquote>All code created in the following sections can also be found in this repository: <a href="https://github.com/FlowSquad/devops-github-packages">https://github.com/FlowSquad/devops-github-packages</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/359/1*bCUy8ZxuMb0C8kG_PVJ5-A.png" /><figcaption>Our project structure in IntelliJ</figcaption></figure><p>First of all, we will create a new project called “<em>devops-github-packages</em>” with two modules: “<em>devops-github-packages-main</em>” and “<em>devops-github-packages-library</em>”.</p><p>The main module will eventually have a dependency on the library module, which will be downloaded from our private GitHub Packages registry.</p><p>Afterward, we have to adjust the build.gradle file in the library module. We enable the plugin “<em>maven-publish</em>” and configure the target repository:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2b6bf62d112a6749ffb56329240524f9/href">https://medium.com/media/2b6bf62d112a6749ffb56329240524f9/href</a></iframe><p>We have to specify the credentials, which are defined above, in the gradle.properties file in this module. Choose your GitHub login as username and enter your personal access token as key. We will create this token in the next step.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/97e57f2168ab9fbe630598a70544fd0a/href">https://medium.com/media/97e57f2168ab9fbe630598a70544fd0a/href</a></iframe><p>To create a personal access token, we need to open the profile settings in GitHub. Then we click “Developer settings” at the bottom of the navigation. From there, we select “Personal access tokens” and click “Generate new token”. Let’s give a name like “GitHub Packages Access Token” and the following scopes: repo, write:packages, read:packages, read:org (if your repository is inside an organization).</p><p>Next, we click on “Generate token”. We then copy the displayed token into the gradle.properties file we created in the previous step. Of course, the token must <strong>never be checked into GitHub</strong>, because it is equivalent to a password.</p><p>We now create a new class called “ LibraryClass” in the library module, which contains the code that we will later call from the main module:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/003ca86d962534553a31ceda13d7f563/href">https://medium.com/media/003ca86d962534553a31ceda13d7f563/href</a></iframe><p>Now, when we run the command “<em>./gradlew :devops-github-packages-library:publish</em>”, Gradle will build the library and publish it to GitHub. There we should be able to see it in our repository in the “Packages” tab:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*ITEPie2n3lb60p23q97V9A.png" /><figcaption>The Packages tab in your GitHub repository</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*B6eKuKc97rmHnpcPzQzZWw.png" /><figcaption>When you click on your artifact version, you’ll see a lot of details</figcaption></figure><p>Now we take care of the main module. The build.gradle must be modified in this module as well. The dependencies block contains the artifact that is built from the library module. Of course, we could also simply link the module, but we want to test GitHub packages, right? ;)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4bfd339b92ce09634ba6d6f2bdfe065f/href">https://medium.com/media/4bfd339b92ce09634ba6d6f2bdfe065f/href</a></iframe><p>We need to provide the credentials in this module as well, similar to how we did in the library module. Therefore we copy the gradle.properties file created above into the main module.</p><blockquote>Be careful: You need an access token for fetching artifacts, even if they are hosted in public repositories!</blockquote><p>At this point, we still have to create a main class in which we call the utility method that we created in the library class:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1c09326ce78b9edc0a9b54a8a0c5dedf/href">https://medium.com/media/1c09326ce78b9edc0a9b54a8a0c5dedf/href</a></iframe><p>Now, when we start the application, Gradle fetches the artifact we built before from GitHub, builds our main module, and runs it. If everything works, we should see the following message printed to the console:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*Hj2ESbwx6YjVZoJQoxMlXQ.png" /><figcaption>The console output</figcaption></figure><p>We have successfully published an artifact to GitHub Packages, downloaded it, and used it. However, there are some pitfalls you should know before using it productively:</p><ol><li><strong>Snapshots do not work</strong><br>Even though the docs state that snapshots are supported, we couldn’t get them to work. The first few builds work just fine; however, old snapshots are not being removed. Instead, new artifacts are constantly being added to that same release, which eventually stops working. From this point on, you will always fetch old snapshots.</li><li><strong>Multiple artifacts per release do not work</strong><br>As soon as you try to upload JavaDoc and source artifacts in addition to the library itself, the repository enters an unstable state. Even loading existing artifacts or publishing new library versions will fail with a 400 error. In our case, only deleting the artifact or repository could fix this.</li><li><strong>Public versions cannot be deleted</strong><br>While it’s possible to delete artifact versions in private repositories, GitHub doesn’t allow you to do this in public repositories. Therefore, you should carefully consider what to publish and what to keep private ;)</li><li><strong>The token needs the correct scopes</strong><br>The personal access token used to access the artifacts must have precisely the scopes listed above for everything to work. If any of these scopes is missing, you will receive error messages that often do not indicate the lack of permission!</li><li><strong>Dynamic versions will prevent publishing</strong><br>If you are using Spring Boot, and have dynamic versions enabled, the publishing will fail because the versions are not locked. While this is not directly related to GitHub packages, it is still good to be aware of. To fix this, you need to adjust the build.gradle file, so that there is a version mapping in the publishing block:</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d76e7d4f391a78264a902d78343ca01a/href">https://medium.com/media/d76e7d4f391a78264a902d78343ca01a/href</a></iframe><p>In the second part of the blog post series, we’ll take a look at how we can use GitHub Actions to automate our build pipeline so that the latest version is automatically published whenever new code is pushed. See you next time!</p><p><em>Originally published in German at </em><a href="https://www.miragon.io/blog/devops-mit-github-teil-1-github-packages-mit-gradle/"><em>miragon.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4253cdf7ca6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/devops-with-github-part-1-github-packages-with-gradle-c4253cdf7ca6">DevOps with GitHub — Part 1: GitHub Packages with Gradle</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>