<?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 Sandeep Rajbhar on Medium]]></title>
        <description><![CDATA[Stories by Sandeep Rajbhar on Medium]]></description>
        <link>https://medium.com/@sandeeprajbhartechgeek?source=rss-e15528188805------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FKYbmY1ktn8MAB9QYcXOCw.png</url>
            <title>Stories by Sandeep Rajbhar on Medium</title>
            <link>https://medium.com/@sandeeprajbhartechgeek?source=rss-e15528188805------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 20:04:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sandeeprajbhartechgeek/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[End-to-end CI/CD pipeline Setup with Azure DevOps for Mobile App: Common Pipeline—Part 5]]></title>
            <link>https://sandeeprajbhartechgeek.medium.com/end-to-end-ci-cd-pipeline-setup-with-azure-devops-for-mobile-app-common-pipeline-part-5-9246272c0128?source=rss-e15528188805------2</link>
            <guid isPermaLink="false">https://medium.com/p/9246272c0128</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[microsoft-graph-api]]></category>
            <category><![CDATA[branching-strategy]]></category>
            <category><![CDATA[azure-devops]]></category>
            <category><![CDATA[webhooks]]></category>
            <dc:creator><![CDATA[Sandeep Rajbhar]]></dc:creator>
            <pubDate>Mon, 17 Jul 2023 03:41:47 GMT</pubDate>
            <atom:updated>2023-10-11T05:52:10.482Z</atom:updated>
            <content:encoded><![CDATA[<p>Please follow these steps to set up a common pipeline for both iOS and Android, along with the sonar cloud quality gate.</p><p><strong>Prerequisite</strong></p><p>You must have already gone through <a href="https://medium.com/@sandeeprajbhartechgeek/end-to-end-ci-cd-pipeline-setup-with-azure-devops-for-mobile-app-ios-part1-6da0cdb7eb17">PART 1</a>, <a href="https://medium.com/@sandeeprajbhartechgeek/end-to-end-ci-cd-pipeline-setup-with-azure-devops-for-mobile-app-android-part-2-9d7b11fb115f">PART 2, </a><a href="https://medium.com/@sandeeprajbhartechgeek/end-to-end-ci-cd-pipeline-setup-with-azure-devops-for-mobile-app-sonarcloud-integration-part-3-be24e009225e">PART 3</a>, and <a href="https://medium.com/@sandeeprajbhartechgeek/end-to-end-ci-cd-pipeline-setup-with-azure-devops-for-mobile-app-branch-strategy-and-release-c962b40ccf74">PART 4 </a>of this series. Along with <a href="https://medium.com/@sandeeprajbhartechgeek/sonar-cloud-integration-with-github-repository-for-react-native-app-part1-a086153590eb">Sonar Cloud with GitHub</a>.</p><p><strong>Create a common Pipeline:</strong></p><p>Since we already know how to create a pipeline and release it in Part 4, Here we will just look at a new common YAML file.</p><blockquote># Starter pipeline</blockquote><blockquote># Start with a minimal pipeline that you can customize to build and deploy your code.</blockquote><blockquote># Add steps that build, run tests, deploy, and more:</blockquote><blockquote># <a href="https://aka.ms/yaml">https://aka.ms/yaml</a></blockquote><blockquote>trigger:</blockquote><blockquote>- master</blockquote><blockquote>pool:</blockquote><blockquote>vmImage: macOS-11</blockquote><blockquote><strong>jobs:</strong></blockquote><blockquote><strong>- job: TestViaJob # name of the job (A-Z, a-z, 0–9, and underscore)</strong></blockquote><blockquote><strong>timeoutInMinutes: 300</strong></blockquote><blockquote><strong>steps:</strong></blockquote><blockquote><strong>- checkout: self</strong></blockquote><blockquote><strong>persistCredentials: true</strong></blockquote><blockquote><strong>clean: true</strong></blockquote><blockquote><strong>- task: NodeTool@0</strong></blockquote><blockquote><strong>displayName: ‘Install Node’</strong></blockquote><blockquote><strong>inputs:</strong></blockquote><blockquote><strong>versionSpec: ‘v16.6.2’ # you can use your desired version here</strong></blockquote><blockquote><strong>- script: yarn install</strong></blockquote><blockquote><strong>displayName: Install Dependencies</strong></blockquote><blockquote>- task: SonarSource.sonarcloud.14d9cde6-c1da-4d55-aa01–2965cd301255.SonarCloudPrepare@1</blockquote><blockquote>displayName: ‘Prepare analysis on SonarCloud’</blockquote><blockquote>inputs:</blockquote><blockquote>SonarCloud: SonarClodPOCServiceCon</blockquote><blockquote>organization: ‘*************’</blockquote><blockquote>scannerMode: CLI</blockquote><blockquote>configMode: manual</blockquote><blockquote>cliProjectKey: ‘*************’</blockquote><blockquote>cliProjectName: PM.SonarCloudPOC</blockquote><blockquote>extraProperties: |</blockquote><blockquote>sonar.exclusions=**/android/**/*.* , **/ios/**/*.* , **/node_modules/**/*.* , **/__tests__/*.tsx , **/coverage/**/*.js,**/setupTests.ts,**/babel.config.js, **/metro.config.js,</blockquote><blockquote>sonar.coverage.exclusions = **/android/**/*.* , **/ios/**/*.* , **/node_modules/**/*.*</blockquote><blockquote>sonar.javascript.file.suffixes= .jsx , .js</blockquote><blockquote>sonar.typescript.file.suffixes= .tsx , .ts</blockquote><blockquote>sonar.java.binaries=-</blockquote><blockquote>sonar.c.file.suffixes=-</blockquote><blockquote>sonar.cpp.file.suffixes=-</blockquote><blockquote>sonar.objc.file.suffixes=-</blockquote><blockquote>sonar.html.file.suffixes=-</blockquote><blockquote>sonar.css.file.suffixes=-</blockquote><blockquote>sonar.java.file.suffixes=-</blockquote><blockquote>sonar.sources=.</blockquote><blockquote>sonar.language=js , jsx, ts , tsx</blockquote><blockquote>sonar.tests=./__tests__</blockquote><blockquote>sonar.javascript.lcov.reportPaths=./coverage/lcov.info</blockquote><blockquote>sonar.testExecutionReportPaths=./test-report.xml</blockquote><blockquote>sonar.sourceEncoding=UTF-8</blockquote><blockquote>enabled: true</blockquote><blockquote>- task: SonarSource.sonarcloud.ce096e50–6155–4de8–8800–4221aaeed4a1.SonarCloudAnalyze@1</blockquote><blockquote>displayName: ‘Run Code Analysis’</blockquote><blockquote>enabled: true</blockquote><blockquote>- task: SonarSource.sonarcloud.38b27399-a642–40af-bb7d-9971f69712e8.SonarCloudPublish@1</blockquote><blockquote>displayName: ‘Publish Quality Gate Result’</blockquote><blockquote>enabled: true</blockquote><blockquote>- task: SimondeLang.sonarcloud-buildbreaker.sonar-buildbreaker.sonarcloud-buildbreaker@2</blockquote><blockquote>displayName: ‘Break build on quality gate failure’</blockquote><blockquote>inputs:</blockquote><blockquote>SonarCloud: SonarClodPOCServiceCon</blockquote><blockquote>organization: ‘*************’</blockquote><blockquote>enabled: true</blockquote><blockquote>- task: Gradle@2</blockquote><blockquote>displayName: ‘gradlew build’</blockquote><blockquote>inputs:</blockquote><blockquote>gradleWrapperFile: android/gradlew</blockquote><blockquote>workingDirectory: android</blockquote><blockquote>publishJUnitResults: false</blockquote><blockquote>- task: AndroidSigning@3</blockquote><blockquote>displayName: ‘Signing and aligning APK file(s) **/*.apk’</blockquote><blockquote>inputs:</blockquote><blockquote>apksignerKeystoreFile: ‘*************’</blockquote><blockquote>apksignerKeystorePassword: sonar123</blockquote><blockquote>apksignerKeystoreAlias: sonar0</blockquote><blockquote>apksignerKeyPassword: sonar123</blockquote><blockquote>zipalign: false</blockquote><blockquote>- task: CopyFiles@2</blockquote><blockquote>displayName: ‘Copy Files to: $(build.artifactstagingdirectory)’</blockquote><blockquote>inputs:</blockquote><blockquote>SourceFolder: ‘$(system.defaultworkingdirectory)’</blockquote><blockquote>Contents: ‘**/*.apk’</blockquote><blockquote>TargetFolder: ‘$(build.artifactstagingdirectory)’</blockquote><blockquote>condition: succeededOrFailed()</blockquote><blockquote>- task: PublishBuildArtifacts@1</blockquote><blockquote>displayName: ‘Publish Artifact: drop’</blockquote><blockquote>inputs:</blockquote><blockquote>PathtoPublish: ‘$(build.artifactstagingdirectory)’</blockquote><blockquote>condition: succeededOrFailed()</blockquote><blockquote><strong>- task: CocoaPods@0</strong></blockquote><blockquote><strong>displayName: ‘Install CocoaPods’</strong></blockquote><blockquote><strong>inputs:</strong></blockquote><blockquote><strong>workingDirectory: ‘ios’</strong></blockquote><blockquote>- task: InstallAppleCertificate@2</blockquote><blockquote>displayName: ‘Install an Apple certificate’</blockquote><blockquote>inputs:</blockquote><blockquote>certSecureFile: ‘iosAzureDevOPSCICD_distribution.p12’</blockquote><blockquote>certPwd: ‘$(P12password)’</blockquote><blockquote>- task: InstallAppleProvisioningProfile@1</blockquote><blockquote>displayName: ‘Install an Apple provisioning profile’</blockquote><blockquote>inputs:</blockquote><blockquote>provProfileSecureFile: AzueDevOpsCICDTest.mobileprovision</blockquote><blockquote>- task: Xcode@5</blockquote><blockquote>displayName: ‘Xcode build’</blockquote><blockquote>inputs:</blockquote><blockquote>actions: ‘build’</blockquote><blockquote>configuration: ‘$(Configuration)’</blockquote><blockquote>xcWorkspacePath: ‘ios/QualityGateTest.xcworkspace’</blockquote><blockquote>scheme: ‘QualityGateTest’</blockquote><blockquote>packageApp: true</blockquote><blockquote>signingOption: ‘manual’</blockquote><blockquote>signingIdentity: ‘$(APPLE_CERTIFICATE_SIGNING_IDENTITY)’</blockquote><blockquote>provisioningProfileUuid: ‘$(APPLE_PROV_PROFILE_UUID)’</blockquote><blockquote>destinationPlatformOption: ‘iOS’</blockquote><blockquote>destinationSimulators: ‘iPhone 12’</blockquote><blockquote>- task: CopyFiles@2</blockquote><blockquote>displayName: ‘Copy Files to: $(build.artifactstagingdirectory)’</blockquote><blockquote>inputs:</blockquote><blockquote>SourceFolder: ‘$(system.defaultworkingdirectory)’</blockquote><blockquote>Contents: ‘**/*.ipa’</blockquote><blockquote>TargetFolder: ‘$(build.artifactstagingdirectory)’</blockquote><blockquote>condition: succeededOrFailed()</blockquote><blockquote>- task: PublishBuildArtifacts@1</blockquote><blockquote>displayName: ‘Publish Artifact: drop’</blockquote><blockquote>inputs:</blockquote><blockquote>PathtoPublish: ‘$(build.artifactStagingDirectory)’</blockquote><blockquote>condition: succeededOrFailed()</blockquote><p>There are a few new lines added for the common YAML file highlighted in bold; let’s see them one by one.</p><p>1) Jobs: Jobs are added at the top level of the YAML file to increase a pipeline timeout from the default of 60 minutes.</p><p>2) Node tool: The new Mac machine provided by the Azure pipeline did not have a default node. So we are installing it from the pipeline, it will install the node module regardless of whether it is present or not.</p><p>3) Yarn install: Installing a node module in a VM via pipeline</p><p>4) Install Cocoa pods: Installing pods in a VM via pipeline</p><p><strong>Note:</strong></p><p>a) The node installation is a very important step. If the node is not installed on the VM, it will not create an Artifact and will give some error like the one mentioned below for iOS and Android.</p><p><a href="https://developercommunity.visualstudio.com/t/Android---main-module-field-for-%E2%80%9Creact/1494126?space=22&amp;entry=problem&amp;viewtype=all">https://developercommunity.visualstudio.com/t/Android---main-module-field-for-%E2%80%9Creact/1494126?space=22&amp;entry=problem&amp;viewtype=all</a></p><p><a href="https://developercommunity.visualstudio.com/t/IOS---Running-script-CP-User-Generate/1494122?space=22&amp;entry=problem&amp;viewtype=all">https://developercommunity.visualstudio.com/t/IOS---Running-script-CP-User-Generate/1494122?space=22&amp;entry=problem&amp;viewtype=all</a></p><p>b) Jobs were added to the pipeline to tackle the timeout issue, but we need to be careful about indentation while changing the pipeline.</p><p>Enjoy !!!!!.</p><p>This is a standard way to create a CICD for a multi-environment mobile app in native, React Native, or Flutter.</p><p>However, I have worked at the advanced level of CICD and using in our application, as mentioned below</p><ol><li>Creating a dynamic single pipeline for all the environments (SIT, UAT, and PROD) without creating three different pipelines.</li><li>Using WebHook to automatically send the Release Notes to the Microsoft Teams channel.</li><li>Using Azure&#39;s Microsoft Graph API to upload ADHoc IPA and APK for testers to use for testing in the browser stack or other platform.</li><li>Upload the IPA and APK automatically to the browser stack and run the test.</li><li>Generate the test result.</li></ol><p>Connect with me on my email ID, SandeepRajbhar1985@gmail.com for more detail on the above topic and to discuss how advanced we can go and what else we can do to make CICD better along with Automation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9246272c0128" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[End-to-end CI/CD pipeline Setup with Azure DevOps for Mobile App: Branch Strategy and Release…]]></title>
            <link>https://sandeeprajbhartechgeek.medium.com/end-to-end-ci-cd-pipeline-setup-with-azure-devops-for-mobile-app-branch-strategy-and-release-c962b40ccf74?source=rss-e15528188805------2</link>
            <guid isPermaLink="false">https://medium.com/p/c962b40ccf74</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[deployment-pipelines]]></category>
            <category><![CDATA[releases]]></category>
            <category><![CDATA[yaml]]></category>
            <category><![CDATA[sonarcloud]]></category>
            <dc:creator><![CDATA[Sandeep Rajbhar]]></dc:creator>
            <pubDate>Sun, 09 Jul 2023 06:04:28 GMT</pubDate>
            <atom:updated>2023-10-11T06:08:26.656Z</atom:updated>
            <content:encoded><![CDATA[<h3>End-to-end CI/CD pipeline Setup with Azure DevOps for Mobile App: <strong>Branch Strategy and Release Pipeline—</strong>Part 4.</h3><p>In this article, we will set up a branching strategy with the help of a release pipeline to deploy the app to the app store and play store with multiple branches, schemes (for iOS), or flavors (for Android).</p><p><strong>Prerequisite</strong></p><p>You must have already gone through <a href="https://medium.com/@sandeeprajbhartechgeek/end-to-end-ci-cd-pipeline-setup-with-azure-devops-for-mobile-app-ios-part1-6da0cdb7eb17">PART 1</a>, <a href="https://medium.com/@sandeeprajbhartechgeek/end-to-end-ci-cd-pipeline-setup-with-azure-devops-for-mobile-app-android-part-2-9d7b11fb115f">PART 2 </a>and <a href="https://medium.com/@sandeeprajbhartechgeek/end-to-end-ci-cd-pipeline-setup-with-azure-devops-for-mobile-app-sonarcloud-integration-part-3-be24e009225e">PART 3</a> of this series. Along with <a href="https://medium.com/@sandeeprajbhartechgeek/sonar-cloud-integration-with-github-repository-for-react-native-app-part1-a086153590eb">Sonar Cloud with GitHub</a>.</p><p>Till now, we have created a pipeline with a single branch, and that pipeline deploys the app to the app store and play store with a single scheme or flavor. To create another deployment with another branch, scheme, or flavor, we need another pipeline. To avoid the creation of multiple pipelines, we need a solution where we can create a single pipeline and dynamically select a branch, scheme, or flavor. A YAML file and code are solutions for the same. Basically, the YAML file allows you to write your own code and customize it as per different configurations and trigger branches.</p><p>Let&#39;s start,</p><h3>Create Artifacts.</h3><ol><li>Go to Pipeline -&gt; Select Azure repo -&gt; Select Repository -&gt; Starter pipeline -&gt;</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*q9A1hvkxju-pzvrzZGDGPA.png" /></figure><p>2. Give some names to files related to platforms like iOS or Android.</p><p><strong>iOS Steup:</strong></p><p>a) Change the “vmImage” name to “macOS-10.15” Or the latest. Now remove some unwanted code from yaml file mentioned below,</p><blockquote>- script: echo Hello, world!</blockquote><blockquote>displayName: ‘Run a one-line script’</blockquote><blockquote>- script: |</blockquote><blockquote>echo Add other tasks to build, test, and deploy your project.</blockquote><blockquote>echo See <a href="https://aka.ms/yaml">https://aka.ms/yaml</a></blockquote><blockquote>displayName: ‘Run a multi-line script’</blockquote><p>b) Now you can copy and paste code as per job from another existing pipeline like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*-VP5dVuXI755oaTf6gmJfw.png" /></figure><p>You can create your job in the YAML file and do the manual configuration exactly as we did previously in our classical editor pipeline,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*zoDDuTo4OdHzh83gTmA3nQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*YkDyjTxGSKKfmaXHSY1cdg.png" /></figure><p>c) Now copy and paste below our workable existing code into your IOS YAML file.</p><blockquote># Starter pipeline</blockquote><blockquote># Start with a minimal pipeline that you can customize to build and deploy your code.</blockquote><blockquote># Add steps that build, run tests, deploy, and more:</blockquote><blockquote># <a href="https://aka.ms/yaml">https://aka.ms/yaml</a></blockquote><blockquote>trigger:</blockquote><blockquote>- master</blockquote><blockquote>pool:</blockquote><blockquote>vmImage: macOS-10.15</blockquote><blockquote>steps:</blockquote><blockquote>- task: SonarSource.sonarcloud.14d9cde6-c1da-4d55-aa01–2965cd301255.SonarCloudPrepare@1</blockquote><blockquote>displayName: ‘Prepare analysis on SonarCloud’</blockquote><blockquote>inputs:</blockquote><blockquote>SonarCloud: SonarClodPOCServiceCon</blockquote><blockquote>organization: ‘***********’</blockquote><blockquote>scannerMode: CLI</blockquote><blockquote>configMode: manual</blockquote><blockquote>cliProjectKey: ‘***********’</blockquote><blockquote>cliProjectName: PM.SonarCloudPOC</blockquote><blockquote>extraProperties: |</blockquote><blockquote># Additional properties that will be passed to the scanner,</blockquote><blockquote># Put one key=value per line, example:</blockquote><blockquote># sonar.exclusions=**/*.bin</blockquote><blockquote>sonar.exclusions=**/android/**/*.* , **/ios/**/*.* , **/__tests__/*.tsx , **/coverage/**/*.js,**/setupTests.ts,**/babel.config.js, **/metro.config.js,</blockquote><blockquote>sonar.coverage.exclusions = **/android/**/*.* , **/ios/**/*.* , **/node_modules/**/*.*</blockquote><blockquote>sonar.javascript.file.suffixes= .jsx , .js</blockquote><blockquote>sonar.typescript.file.suffixes= .tsx , .ts</blockquote><blockquote>sonar.java.binaries=-</blockquote><blockquote>sonar.c.file.suffixes=-</blockquote><blockquote>sonar.cpp.file.suffixes=-</blockquote><blockquote>sonar.objc.file.suffixes=-</blockquote><blockquote>sonar.html.file.suffixes=-</blockquote><blockquote>sonar.css.file.suffixes=-</blockquote><blockquote>sonar.java.file.suffixes=-</blockquote><blockquote>sonar.sources=.</blockquote><blockquote>sonar.language=js , jsx, ts , tsx</blockquote><blockquote>sonar.tests=./__tests__</blockquote><blockquote>sonar.javascript.lcov.reportPaths=./coverage/lcov.info</blockquote><blockquote>sonar.testExecutionReportPaths=./test-report.xml</blockquote><blockquote>sonar.sourceEncoding=UTF-8</blockquote><blockquote>enabled: true</blockquote><blockquote>- task: SonarSource.sonarcloud.ce096e50–6155–4de8–8800–4221aaeed4a1.SonarCloudAnalyze@1</blockquote><blockquote>displayName: ‘Run Code Analysis’</blockquote><blockquote>enabled: true</blockquote><blockquote>- task: SonarSource.sonarcloud.38b27399-a642–40af-bb7d-9971f69712e8.SonarCloudPublish@1</blockquote><blockquote>displayName: ‘Publish Quality Gate Result’</blockquote><blockquote>enabled: true</blockquote><blockquote>- task: SimondeLang.sonarcloud-buildbreaker.sonar-buildbreaker.sonarcloud-buildbreaker@2</blockquote><blockquote>displayName: ‘Break build on quality gate failure’</blockquote><blockquote>inputs:</blockquote><blockquote>SonarCloud: SonarClodPOCServiceCon</blockquote><blockquote>organization: ‘***********’</blockquote><blockquote>enabled: true</blockquote><blockquote>- task: InstallAppleCertificate@2</blockquote><blockquote>displayName: ‘Install an Apple certificate’</blockquote><blockquote>inputs:</blockquote><blockquote>certSecureFile: ‘iosAzureDevOPSCICD_distribution.p12’</blockquote><blockquote>certPwd: ‘$(P12password)’</blockquote><blockquote>- task: InstallAppleProvisioningProfile@1</blockquote><blockquote>displayName: ‘Install an Apple provisioning profile’</blockquote><blockquote>inputs:</blockquote><blockquote>provProfileSecureFile: AzueDevOpsCICDTest.mobileprovision</blockquote><blockquote>- task: Xcode@5</blockquote><blockquote>displayName: ‘Xcode build’</blockquote><blockquote>inputs:</blockquote><blockquote>xcWorkspacePath: ios/QualityGateTest.xcworkspace</blockquote><blockquote>scheme: QualityGateTest</blockquote><blockquote>packageApp: true</blockquote><blockquote>signingOption: manual</blockquote><blockquote>signingIdentity: ‘$(APPLE_CERTIFICATE_SIGNING_IDENTITY)’</blockquote><blockquote>provisioningProfileUuid: ‘$(APPLE_PROV_PROFILE_UUID)’</blockquote><blockquote>destinationPlatformOption: iOS</blockquote><blockquote>destinationSimulators: ‘iPhone 12’</blockquote><blockquote>- task: CopyFiles@2</blockquote><blockquote>displayName: ‘Copy Files to: $(build.artifactstagingdirectory)’</blockquote><blockquote>inputs:</blockquote><blockquote>SourceFolder: ‘$(system.defaultworkingdirectory)’</blockquote><blockquote>Contents: ‘**/*.ipa’</blockquote><blockquote>TargetFolder: ‘$(build.artifactstagingdirectory)’</blockquote><blockquote>condition: succeededOrFailed()</blockquote><blockquote>- task: PublishBuildArtifacts@1</blockquote><blockquote>displayName: ‘Publish Artifact: drop’</blockquote><blockquote>inputs:</blockquote><blockquote>PathtoPublish: ‘$(build.artifactStagingDirectory)’</blockquote><blockquote>condition: succeededOrFailed()</blockquote><p>d) Now save the file, select “commit to master branch directly,” and Run. It will create artifacts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*_1YBNzklWY2g8fO0hakkyw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/1*sNCfFU9y2ZAjiIVrz_lvZg.png" /></figure><p>This YAML file will only have a configuration for Sonar Cloud and to create an artifact, i.e., an APK or IPA. The YAML file configuration for the master branch is done. This pipeline with the above configuration will only run when the developer merges code into the master branch and makes an auto-trigger call on the master branch. It will not work on the UAT branch merge.</p><p>e) Now go to the UAT branch from the Source tree or git create a new YAML file with the same name or copy and paste the same file into UAT. Merge the code. At the end, the same file should appear in the UAT (or PROD, or SIT) branch. See the above YAML code and change the configuration code highlighted in yellow. These changes need to be made according to the branch and scheme. The YAML code for UAT will look like this,</p><blockquote># Starter pipeline</blockquote><blockquote># Start with a minimal pipeline that you can customize to build and deploy your code.</blockquote><blockquote># Add steps that build, run tests, deploy, and more:</blockquote><blockquote># <a href="https://aka.ms/yaml">https://aka.ms/yaml</a></blockquote><blockquote>trigger:</blockquote><blockquote>- UAT</blockquote><blockquote>pool:</blockquote><blockquote>vmImage: macOS-10.15</blockquote><blockquote>steps:</blockquote><blockquote>- task: SonarSource.sonarcloud.14d9cde6-c1da-4d55-aa01–2965cd301255.SonarCloudPrepare@1</blockquote><blockquote>displayName: ‘Prepare analysis on SonarCloud’</blockquote><blockquote>inputs:</blockquote><blockquote>SonarCloud: SonarClodPOCServiceCon</blockquote><blockquote>organization: ‘***********’</blockquote><blockquote>scannerMode: CLI</blockquote><blockquote>configMode: manual</blockquote><blockquote>cliProjectKey: ‘***********’</blockquote><blockquote>cliProjectName: ‘***********’</blockquote><blockquote>extraProperties: |</blockquote><blockquote># Additional properties that will be passed to the scanner,</blockquote><blockquote># Put one key=value per line, example:</blockquote><blockquote># sonar.exclusions=**/*.bin</blockquote><blockquote>sonar.exclusions=**/android/**/*.* , **/ios/**/*.* , **/__tests__/*.tsx , **/coverage/**/*.js,**/setupTests.ts,**/babel.config.js, **/metro.config.js,</blockquote><blockquote>sonar.coverage.exclusions = **/android/**/*.* , **/ios/**/*.* , **/node_modules/**/*.*</blockquote><blockquote>sonar.javascript.file.suffixes= .jsx , .js</blockquote><blockquote>sonar.typescript.file.suffixes= .tsx , .ts</blockquote><blockquote>sonar.java.binaries=-</blockquote><blockquote>sonar.c.file.suffixes=-</blockquote><blockquote>sonar.cpp.file.suffixes=-</blockquote><blockquote>sonar.objc.file.suffixes=-</blockquote><blockquote>sonar.html.file.suffixes=-</blockquote><blockquote>sonar.css.file.suffixes=-</blockquote><blockquote>sonar.java.file.suffixes=-</blockquote><blockquote>sonar.sources=.</blockquote><blockquote>sonar.language=js , jsx, ts , tsx</blockquote><blockquote>sonar.tests=./__tests__</blockquote><blockquote>sonar.javascript.lcov.reportPaths=./coverage/lcov.info</blockquote><blockquote>sonar.testExecutionReportPaths=./test-report.xml</blockquote><blockquote>sonar.sourceEncoding=UTF-8</blockquote><blockquote>enabled: true</blockquote><blockquote>- task: SonarSource.sonarcloud.ce096e50–6155–4de8–8800–4221aaeed4a1.SonarCloudAnalyze@1</blockquote><blockquote>displayName: ‘Run Code Analysis’</blockquote><blockquote>enabled: true</blockquote><blockquote>- task: SonarSource.sonarcloud.38b27399-a642–40af-bb7d-9971f69712e8.SonarCloudPublish@1</blockquote><blockquote>displayName: ‘Publish Quality Gate Result’</blockquote><blockquote>enabled: true</blockquote><blockquote>- task: SimondeLang.sonarcloud-buildbreaker.sonar-buildbreaker.sonarcloud-buildbreaker@2</blockquote><blockquote>displayName: ‘Break build on quality gate failure’</blockquote><blockquote>inputs:</blockquote><blockquote>SonarCloud: SonarClodPOCServiceCon</blockquote><blockquote>organization: ‘‘***********’</blockquote><blockquote>enabled: true</blockquote><blockquote>- task: InstallAppleCertificate@2</blockquote><blockquote>displayName: ‘Install an Apple certificate’</blockquote><blockquote>inputs:</blockquote><blockquote>certSecureFile: ‘iosAzureDevOPSCICD_distribution.p12’</blockquote><blockquote>certPwd: ‘$(P12password)’</blockquote><blockquote>- task: InstallAppleProvisioningProfile@1</blockquote><blockquote>displayName: ‘Install an Apple provisioning profile’</blockquote><blockquote>inputs:</blockquote><blockquote>provProfileSecureFile: AzueDevOpsCICDUAT.mobileprovision</blockquote><blockquote>- task: Xcode@5</blockquote><blockquote>displayName: ‘Xcode build’</blockquote><blockquote>inputs:</blockquote><blockquote>actions: ‘build’</blockquote><blockquote>configuration: ‘$(ConfigurationUAT)’</blockquote><blockquote>xcWorkspacePath: ‘ios/QualityGateTest.xcworkspace’</blockquote><blockquote>scheme: ‘UAT_QualityGateTest’</blockquote><blockquote>packageApp: true</blockquote><blockquote>signingOption: ‘manual’</blockquote><blockquote>signingIdentity: ‘$(APPLE_CERTIFICATE_SIGNING_IDENTITY)’</blockquote><blockquote>provisioningProfileUuid: ‘$(APPLE_PROV_PROFILE_UUID)’</blockquote><blockquote>destinationPlatformOption: ‘iOS’</blockquote><blockquote>destinationSimulators: ‘iPhone 12’</blockquote><blockquote>- task: CopyFiles@2</blockquote><blockquote>displayName: ‘Copy Files to: $(build.artifactstagingdirectory)’</blockquote><blockquote>inputs:</blockquote><blockquote>SourceFolder: ‘$(system.defaultworkingdirectory)’</blockquote><blockquote>Contents: ‘**/*.ipa’</blockquote><blockquote>TargetFolder: ‘$(build.artifactstagingdirectory)’</blockquote><blockquote>condition: succeededOrFailed()</blockquote><blockquote>- task: PublishBuildArtifacts@1</blockquote><blockquote>displayName: ‘Publish Artifact: drop’</blockquote><blockquote>inputs:</blockquote><blockquote>PathtoPublish: ‘$(build.artifactStagingDirectory)’</blockquote><blockquote>condition: succeededOrFailed()</blockquote><p>f) The above dynamic variable comes from the below configuration</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/1*aAvxfMnfpI8kyHmmgwMLnA.png" /></figure><p>The UAT configuration is done. The same needs to be done for SIT or PROD.</p><p><strong>Android Steup:</strong></p><p>a) Create a YAML file for Android exactly like we did for iOS.</p><p>b) First, create the master branch. Copy and paste the below code into your Android YAML file.</p><blockquote># Starter pipeline</blockquote><blockquote># Start with a minimal pipeline that you can customize to build and deploy your code.</blockquote><blockquote># Add steps that build, run tests, deploy, and more:</blockquote><blockquote># <a href="https://aka.ms/yaml">https://aka.ms/yaml</a></blockquote><blockquote>trigger:</blockquote><blockquote>- master</blockquote><blockquote>pool:</blockquote><blockquote>vmImage: ubuntu-latest</blockquote><blockquote>steps:</blockquote><blockquote>- task: SonarSource.sonarcloud.14d9cde6-c1da-4d55-aa01–2965cd301255.SonarCloudPrepare@1</blockquote><blockquote>displayName: ‘Prepare analysis on SonarCloud’</blockquote><blockquote>inputs:</blockquote><blockquote>SonarCloud: SonarClodPOCServiceCon</blockquote><blockquote>organization: ‘***********’</blockquote><blockquote>scannerMode: CLI</blockquote><blockquote>configMode: manual</blockquote><blockquote>cliProjectKey: ‘***********’</blockquote><blockquote>cliProjectName: ‘***********’</blockquote><blockquote>extraProperties: |</blockquote><blockquote># Additional properties that will be passed to the scanner,</blockquote><blockquote># Put one key=value per line, example:</blockquote><blockquote># sonar.exclusions=**/*.bin</blockquote><blockquote>sonar.exclusions=**/android/**/*.* , **/ios/**/*.* , **/__tests__/*.tsx , **/coverage/**/*.js,**/setupTests.ts,**/babel.config.js, **/metro.config.js,</blockquote><blockquote>sonar.coverage.exclusions = **/android/**/*.* , **/ios/**/*.* , **/node_modules/**/*.*</blockquote><blockquote>sonar.javascript.file.suffixes= .jsx , .js</blockquote><blockquote>sonar.typescript.file.suffixes= .tsx , .ts</blockquote><blockquote>sonar.java.binaries=-</blockquote><blockquote>sonar.c.file.suffixes=-</blockquote><blockquote>sonar.cpp.file.suffixes=-</blockquote><blockquote>sonar.objc.file.suffixes=-</blockquote><blockquote>sonar.html.file.suffixes=-</blockquote><blockquote>sonar.css.file.suffixes=-</blockquote><blockquote>sonar.java.file.suffixes=-</blockquote><blockquote>sonar.sources=.</blockquote><blockquote>sonar.language=js , jsx, ts , tsx</blockquote><blockquote>sonar.tests=./__tests__</blockquote><blockquote>sonar.javascript.lcov.reportPaths=./coverage/lcov.info</blockquote><blockquote>sonar.testExecutionReportPaths=./test-report.xml</blockquote><blockquote>sonar.sourceEncoding=UTF-8</blockquote><blockquote>enabled: true</blockquote><blockquote>- task: SonarSource.sonarcloud.ce096e50–6155–4de8–8800–4221aaeed4a1.SonarCloudAnalyze@1</blockquote><blockquote>displayName: ‘Run Code Analysis’</blockquote><blockquote>enabled: true</blockquote><blockquote>- task: SonarSource.sonarcloud.38b27399-a642–40af-bb7d-9971f69712e8.SonarCloudPublish@1</blockquote><blockquote>displayName: ‘Publish Quality Gate Result’</blockquote><blockquote>enabled: true</blockquote><blockquote>- task: SimondeLang.sonarcloud-buildbreaker.sonar-buildbreaker.sonarcloud-buildbreaker@2</blockquote><blockquote>displayName: ‘Break build on quality gate failure’</blockquote><blockquote>inputs:</blockquote><blockquote>SonarCloud: SonarClodPOCServiceCon</blockquote><blockquote>organization: ‘***********’</blockquote><blockquote>enabled: true</blockquote><blockquote>- task: Gradle@2</blockquote><blockquote>displayName: ‘gradlew build’</blockquote><blockquote>inputs:</blockquote><blockquote>gradleWrapperFile: android/gradlew</blockquote><blockquote>workingDirectory: android</blockquote><blockquote>publishJUnitResults: false</blockquote><blockquote>- task: AndroidSigning@3</blockquote><blockquote>displayName: ‘Signing and aligning APK file(s) **/*.apk’</blockquote><blockquote>inputs:</blockquote><blockquote>apksignerKeystoreFile: sonarcloudkey.keystore</blockquote><blockquote>apksignerKeystorePassword: sonar123</blockquote><blockquote>apksignerKeystoreAlias: sonar0</blockquote><blockquote>apksignerKeyPassword: sonar123</blockquote><blockquote>zipalign: false</blockquote><blockquote>- task: CopyFiles@2</blockquote><blockquote>displayName: ‘Copy Files to: $(build.artifactstagingdirectory)’</blockquote><blockquote>inputs:</blockquote><blockquote>SourceFolder: ‘$(system.defaultworkingdirectory)’</blockquote><blockquote>Contents: ‘**/*.apk’</blockquote><blockquote>TargetFolder: ‘$(build.artifactstagingdirectory)’</blockquote><blockquote>condition: succeededOrFailed()</blockquote><blockquote>- task: PublishBuildArtifacts@1</blockquote><blockquote>displayName: ‘Publish Artifact: drop’</blockquote><blockquote>inputs:</blockquote><blockquote>PathtoPublish: ‘$(build.artifactstagingdirectory)’</blockquote><blockquote>condition: succeededOrFailed()</blockquote><p>c) Now create or copy the file the same as we did in the iOS case in UAT (SIT/ PROD).</p><p>d) Here we do not need to configure any flavor in the YAML file. (Like we did in the case of SCHEME in iOS). In the case of Android, we will select from Android Studio and then commit. We will see that in the next step of “C<strong>onfiguration, Run, and Result.</strong>”</p><h3><strong>Create a release pipeline for app deployment.</strong></h3><p><strong>iOS Deployment:</strong></p><ol><li>Go to Pipeline -&gt; Releases -&gt; New Release Pipeline -&gt; Empty Job.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*XhwxiPsLHvQm6r8gJiryyA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*3aaEO4nqQIFhRhSYQ7YjEw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*2A5PlozCvPAKZtPWFQEzww.png" /></figure><p>2. Set the artifact setting as per the below screenshot</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*5ydVAeQI48wjDl1DLGbSaQ.png" /></figure><p>3. Continuous deployment trigger setting -&gt; Select a branch for which you want to set a stage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*i-QDqTLLGW5kFkQQVFIu-g.png" /></figure><p>4. Pre-deployment conditions -&gt;</p><p>a) Select the Trigger branch and Artifact</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*7_UTWZJgeSi66nmu4mQbhg.png" /></figure><p>b) If you want to do another Sonar Quality check for pass and fail results but we already check this in the build breaker stage, we can keep this <strong>optional</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*iuiRJNFnhIl9SiJ-s-EWhg.png" /></figure><p>c. Stage -&gt; Give a name to the stage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*fwjyF3-NHguhWGPofDY6IQ.png" /></figure><p>d. Job: Do the exact setting we had done previously in Document Part 1 during the “Publish to the App Store TestFlight Track” configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*SAzjpKFlT0wDa6hCE7UZ_g.png" /></figure><p>Only we need to change the bundle ID as per a different scheme and the binary path as per the artifact path created. Uncheck the option “Skip Submission” if you wish to directly publish the app to the tester.</p><p>e. Do the exact same configuration for the UAT (OR SIT / PROD) for the release pipeline.</p><h4><strong><em>Android Deployment:</em></strong></h4><ol><li>To create a release pipeline for Android, do exactly what we did for IOS above except for the few changes mentioned below,</li></ol><p>a) Select different artifacts, i.e., those related to Android.</p><p>b) In the case of the job, we need to do the exact same configuration we saw in Part 2 for Android except for the path of the APK. The APK path will look like this: “$(System.DefaultWorkingDirectory)/_Android_PM.SonarCloudPOC/drop/android/app/build/outputs/apk/master/release/app-master-release.apk”. It will get generated during the pipeline we created above to create the artifact that is our APK file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*dHq7SpGTzvyNznQd4PbQ6A.png" /></figure><p>2. Do the exact same configuration for the UAT (OR SIT / PROD) for the release pipeline.</p><h4><strong>Configuration, Run, and Result</strong></h4><p>iOS: XCode Scheme configuration run and result.</p><p>a) Assuming we already have multiple schemes created along with the “Singing and capability” configuration.</p><p>b) Select the master or UAT scheme and just update the version and build number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*wAtcCtlSHKR-4M638OksZg.png" /></figure><p>c) Commit, and you are done.</p><p>d) Our iOS pipeline will automatically start running and create an artifact, and once that is successful, it will automatically trigger a release pipeline and upload a build to the app store.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*VQHrNJAvqahl2eThbfCn2w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*cTO8Phljqep1xCTMITWi6w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*QZF254TF8yIZKXLUQKrKmg.png" /></figure><p>Android: Android Studio configuration run and the result</p><p>a) Assuming we already have multiple flavors created.</p><p>b) Select the masterRelease or UATRelease flavor and just update the version code and name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*MIreCqvlIaWIm22nopuT7A.png" /></figure><p>c) Commit, and you are done :D.</p><p>d) Our Android pipeline will automatically start running and create an artifact, and once that is successful, it will automatically trigger a release pipeline and upload a build to the Play Store.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*AYGLhCnbJUJLlJGhFxusGg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*SnUL5eh481HbtlPf1s7NBg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*sGBLlSsSbdDlh04TuIGcAg.png" /></figure><p><strong>NOTE:</strong></p><ol><li>Be careful while working on the YAML file code. Indentation is very important. Keep validating the code while writing with the option validate.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*F4jaKZKc0NVN88PrROO1Vw.png" /></figure><p>2. In This Part 4 step, we shall implement a real project to configure the CI/CD pipeline and dump our manual process.</p><p>Finally, we have completed our MVP requirement for CI/CD pipeline setup for the Mobile app. We are ready to go for a production setup with these features.</p><p>The Next Part of this series will be<strong> React Native in the Azure DevOps CICD Common Pipeline for both iOS and Android.</strong></p><p>Keep giving feedback, and let me know what we can improve or other best practices you follow.</p><p>Enjoy D.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c962b40ccf74" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[End-to-end CI/CD pipeline Setup with Azure DevOps for Mobile App: SonarCloud integration—Part 3.]]></title>
            <link>https://sandeeprajbhartechgeek.medium.com/end-to-end-ci-cd-pipeline-setup-with-azure-devops-for-mobile-app-sonarcloud-integration-part-3-be24e009225e?source=rss-e15528188805------2</link>
            <guid isPermaLink="false">https://medium.com/p/be24e009225e</guid>
            <category><![CDATA[sonarqube]]></category>
            <category><![CDATA[code-quality-tools]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[code-review]]></category>
            <category><![CDATA[sonarcloud]]></category>
            <dc:creator><![CDATA[Sandeep Rajbhar]]></dc:creator>
            <pubDate>Sun, 09 Jul 2023 05:19:54 GMT</pubDate>
            <atom:updated>2023-10-11T06:10:50.072Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we shall integrate a sonar cloud job along with a build breaker into the pipeline to check the quality gate result. Break the pipeline in case the quality gate fails and stop the build and release processes. It will save execution time by around 30 minutes on iOS and 20 minutes on Android.</p><p><strong>Prerequisite</strong></p><p>You must have already gone through <a href="https://medium.com/@sandeeprajbhartechgeek/end-to-end-ci-cd-pipeline-setup-with-azure-devops-for-mobile-app-ios-part1-6da0cdb7eb17">PART1</a> and <a href="https://medium.com/@sandeeprajbhartechgeek/end-to-end-ci-cd-pipeline-setup-with-azure-devops-for-mobile-app-android-part-2-9d7b11fb115f">PART2</a> of this series. Along with <a href="https://medium.com/@sandeeprajbhartechgeek/sonar-cloud-integration-with-github-repository-for-react-native-app-part1-a086153590eb">Sonar Cloud with GitHub</a>.</p><ol><li>Select any existing basic pipeline for iOS or Android and add sonar cloud jobs as mentioned below in the screenshot</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*bnpGZtXJPFKjoL8nqi9Tkw.png" /><figcaption>Before Sonar Cloud integration</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*H8RHEpda6G-jYLhUCxCr6A.png" /><figcaption>After Sonar Cloud integration</figcaption></figure><p>2. As we have already learned in the previous article about sonar cloud integration on GitHub and created a pipeline for the same, we will do exactly the same configuration. Apart from that, we will add a build breaker job to our pipeline. Do the configuration as per the below screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*7yAojeG-XYVokx6M-QNUrg.png" /></figure><p>That’s it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*hotzEGZ2mL_IcXoW9yJYaA.png" /><figcaption>Pipeline with Failed quality gate result and build breaker look like this,</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*fGyCx9ydC0heFMwBzNJjDA.png" /><figcaption>The pipeline with passed quality gate result and build breaker look like this,</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be24e009225e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[End-to-end CI/CD pipeline Setup with Azure DevOps for Mobile App: Android—Part 2.]]></title>
            <link>https://sandeeprajbhartechgeek.medium.com/end-to-end-ci-cd-pipeline-setup-with-azure-devops-for-mobile-app-android-part-2-9d7b11fb115f?source=rss-e15528188805------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d7b11fb115f</guid>
            <category><![CDATA[play-store]]></category>
            <category><![CDATA[mobile-devops]]></category>
            <category><![CDATA[pipeline]]></category>
            <category><![CDATA[sonarcloud]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Sandeep Rajbhar]]></dc:creator>
            <pubDate>Thu, 06 Jul 2023 04:12:06 GMT</pubDate>
            <atom:updated>2023-10-11T06:14:02.230Z</atom:updated>
            <content:encoded><![CDATA[<p>I know I am late to post this second part of the End-to-End CI/CD Pipeline Setup with Azure DevOps for Mobile App series. So let&#39;s not delay and jump into the Android part of the Pipeline.</p><p><strong><em>Prerequisite</em></strong></p><p>a) DevOps developers have basic knowledge of manually deploying apps to the Play Store.</p><p>b) The app is already created on the Play Store with all the configuration needed to upload the build.</p><p>c) The first version of the app has already been uploaded to the Play Store, and the tester can test the app.</p><p>Let&#39;s start,</p><ol><li>Go to project -&gt; Select pipeline -&gt; New pipeline: Select “Use the classical editor.”</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*rZTje7Xc1cX2fIARhb1Akg.png" /></figure><p>2. Select Azure repo git -&gt; Repo -&gt; Branch -&gt; Continue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*e5w03Lf_Wl8Cf7NLNIgz9g.png" /></figure><p>3. Search for Android and select</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/326/1*eJAbgn1YvyfRq1H8Bmphqg.png" /></figure><p>4. The above step will create a default Pipeline with some jobs. We need only a few jobs out of that, as per our requirements, and delete the other job. Also, add one more job as “Play Store Release.” We will use this to deploy the app to the Play Store.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DwPkIbtwWLhqZN18HMZeUg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iscgagFnty8mH_oEsQqa-A.png" /></figure><p>5. Select “Get Sources” and do the setup as per the screenshot below. Select the branch from which you want to create a build.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_QIe2pAcmBHpZMvq0MYRxA.png" /></figure><p>6. Create an Agent and give some name. Select MacOS and build the code on the agent machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EE-AE3T5sTrfnUxkJeGLug.png" /></figure><p>7. Do gradlew setting as per the below screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NirOT5T68_yIbNuzgSsZAA.png" /></figure><p>8. Signing and aligning the APK file(s) **/*.apk: Before configuration for this, we must have the below files and settings on the Play Store.</p><blockquote>a) On play store create full app with store listing detail and app icon, Android app image (else app icon issue will come, or app will not be able to upload due to some path issue), create a close build and alpha release, upload first app on play store manually.</blockquote><blockquote>b) Create API access USER from master play store account, give access to user of the app (else will give permission issue), give your API access USER account a owner access. This will generate one json file which we will use during build deployment.</blockquote><blockquote>c) Generate a keystore by CMD line not manually by android studio,</blockquote><blockquote>keytool -genkeypair -v -keystore sonarcloudkey.keystore -alias sonar0 -keyalg RSA -keysize 2048 -validity 10000</blockquote><blockquote>d) Add key store file in Library -&gt; Secure file. Remember the key and keystore password we will use in configuration.</blockquote><p>Do the below configuration,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lbVN2tcYzYXSF6fd7WTYSg.png" /></figure><p>9. Copy Files to: $(build.artifactstagingdirectory) ; Keep this default setting as per screenshot</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*qsZDsHIxyDBizLDaapHskQ.png" /></figure><p>10. Publish Artifact: drop: Keep this default setting as it as per screenshot</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*rEFIhLeRepmt2g_t4_tTPQ.png" /></figure><p>11. Release $(build.artifactstagingdirectory)/**/app-master-release.apk to internal: Before configuration for the release job create a service connection as per below screenshot by using the JSON file created during API access in step 8 -&gt; b</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/1*FFvRf3zZluImt5mU-aWBGQ.png" /></figure><p>Now do the setting as per the screenshot. The APK path needs to change as per branch like in the case of Master it is “$(build.artifactstagingdirectory)/**/app-master-release.apk” and for UAT it can be “$(build.artifactstagingdirectory)/**/app-uat-release.apk”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*Z1kXw8u61y-Fsn-YXmk5Bg.png" /></figure><p>12. Change the version number or build number in Android project and commit to branch. Run the pipeline (Or set trigger action as per branch).</p><p>a) Final successful pipeline should look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*bUvAJLn3wZZioM0ijvxvFg.png" /></figure><p>b) The final successful Play Store upload of IPA will look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*HC5jt1_r31yLw981itbr5g.png" /></figure><p><strong>Common Error:</strong></p><p>1. See the below screenshot for some common errors during app release,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/436/1*2p1N1tDbj8PUC-d4FXBtuw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/316/1*ZF5R2sjjgNr53fCpBp_F6g.png" /></figure><p>Analysis: This issue normally appears when an APK is corrupt. The developer should take care while running NPM on a local machine. Clear the code before merging. Do not commit any file that is not needed and related to the configuration, as it will create a conflict with code running in a VM of Azure DevOps.</p><p>Solution: Clean the Android project, run the sync project with the app, run the app, and commit code to create IPA on CICD.</p><p>m -rf ./node_modules</p><p>yarn cache clean</p><p>yarn install</p><p>Cd iOS</p><p>pod cache clean — all</p><p>pod install</p><p>pod update</p><p>cd android ; ./gradlew clean ; cd ..</p><p>Thanks so much, guys!</p><p>The next Part of the series will be Sonar Cloud integration with the Azure DevOps repo.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d7b11fb115f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cryptography and Signature concept must know before jumping to Web 3.0]]></title>
            <link>https://sandeeprajbhartechgeek.medium.com/cryptography-and-signature-concept-must-know-before-jumping-to-web-3-0-bda32a28821?source=rss-e15528188805------2</link>
            <guid isPermaLink="false">https://medium.com/p/bda32a28821</guid>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[blockchain-technology]]></category>
            <category><![CDATA[keys]]></category>
            <category><![CDATA[signature]]></category>
            <dc:creator><![CDATA[Sandeep Rajbhar]]></dc:creator>
            <pubDate>Sun, 30 Jan 2022 14:02:10 GMT</pubDate>
            <atom:updated>2022-01-31T01:12:14.897Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why I am writing this article?</h3><p>Many times it happens we need to implement SSL certificate pinning in the mobile apps. Many of my junior developer friends come to me and ask about the concept behind SSL pinning. In between, I was also exploring Web 3.0 which talks a lot about Public and Private keys which are related to Cryptography and SSL pinning concept.</p><p>So I thought to write an article so that it can be shared with people and I save my time explaining the same concept.</p><p>However, I will write a separate article on SSL certificate pinning in mobile apps. Before that first understand Cryptography and its type. It is not specific to mobile apps it&#39;s a universal concept that needs to be digested.</p><h3><strong>Cryptography:</strong></h3><p>It is the practice and study of techniques for secure communication in the presence of adversarial behavior. It can be done in two ways Asymmetric and Symmetric Encryption.</p><p>Let&#39;s assume a real-life example where Employee A wants to share a message to Employee B but in an encrypted way so no other can able to understand.</p><h4>Asymmetric encryption:</h4><p>Asymmetric encryption (also known as asymmetric cryptography) <strong>allows users to encrypt information using shared keys</strong>. You need to send a message across the internet, but you don’t want anyone but the intended recipient to see what you’ve written. Asymmetric encryption can help you achieve that goal.</p><p><em>a) Confidentiality I.e. Encryption: Both </em>Employee A <em>and </em>Employee B <em>have their own sets of private and public keys and they want to share a message in an encrypted way.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*djfXCKMwK-tzrQFifbUZKA.png" /></figure><blockquote>From this, we can make sure the data <strong>confidentiality</strong> as the only key in the world can decrypt is the Private key of Employee B.</blockquote><p><em>b) Authenticity: Now let&#39;s consider </em>Employee A does not care about the <strong>confidentiality </strong>and anyone can able to read a message<strong>. </strong>Employee A only wants to make sure<strong> </strong>Employee B gets the message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*Mq2Ea19o7TVlJHHI35yJGg.png" /></figure><p>If Employee B can able to decrypt the message from the Public key of Employee A this proves that Employee A must have sent a message to Employee B.</p><blockquote>This gives us the <strong>authentication.</strong></blockquote><p><em>c) Integrity:</em></p><p>The above scenario also proves that if someone capture the value in the middle and corrupted it. The Employee B when try to decrypt from public key it will get an error. This means that only key in the world can decrypt the message is the Employee A public key and only key in the world can encrypt the Message is Employee A private key. This proves the <strong>i<em>ntegrity.</em></strong></p><blockquote>This process B and C is called <strong>Signature </strong>i.e.<strong> </strong><em>Authenticity and Integrity</em><strong>. </strong>Asymmetric key can be used to create a <strong>Signature and encryption.</strong></blockquote><p><em>Limitations: </em>Asymmetric key can not be used for bulk data as it is slow and more taxing on CPU.</p><p><em>Solution :</em> Symmetric key pair that can used for protecting a bulk data we need to stablised a Symmetric key eiher side of employee.</p><h4>Symmetric encryption:</h4><p>Symmetric encryption is a type of encryption where only one key (a secret key) is used to both encrypt and decrypt electronic information.</p><p>As Symmetric key is smaller set of data and we can not use Asymmetric key for a large size of data , so we will going to use a Asymmetric key to share a Symmetric key. letss see how-&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*AW_ixIy4TVuDyBrbc8FzSA.png" /></figure><p>By using only one Symmetric key both side can send any number of data i.e. called Symmetric encryption.</p><h4>Hybrid encryption:</h4><p>This whole concept call Hybrid encryption I.e. use Asymmetric key pair encryption for key exchange and Symmetric key pair encryption to share bulk data. This how SSL / TLS or SSH protect build data transfer.</p><h3><strong>What about Signature :</strong></h3><p>Digital <strong>signature</strong> is a <strong>cryptographic</strong> value that is calculated from the data and a secret key known only by the signer.</p><p><em>Limitations : </em>Since entire message can not be encrypted by Private key so Asymmetric key pair encryption have some limitation again :(</p><p>Solution: We can sign a fixed and representational sample of entire bulk of message i.e. where Hashing Algorithm come into picture. Send along with entire message.</p><h4>Hashing Algorithm:</h4><p>A hashing algorithm is a mathematical algorithm that converts an input data array of a certain type and arbitrary length to an output bit string of a fixed length.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*QIuDAivDPHO1iNt8Drkc0Q.png" /></figure><p>If both the digest matches that means?</p><blockquote>Message has not change since signed by Employee A. This give us <strong>Integrity</strong></blockquote><blockquote>Only Employee A would have created a Signature with his private key. This give us <strong>Authenticity</strong></blockquote><p>So u can not only create signatire for message but also certificate , software or email can also be signed.</p><p>Please let me know in case of any query or suggestions.</p><p>Thanks so much, guys!!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bda32a28821" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building theme-based Mobile app for a Multi Backend Architecture]]></title>
            <link>https://sandeeprajbhartechgeek.medium.com/building-theme-based-mobile-app-for-a-multi-backend-architecture-f4391f7d7f3?source=rss-e15528188805------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4391f7d7f3</guid>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[graphql-apollo-server]]></category>
            <category><![CDATA[apollo-client]]></category>
            <category><![CDATA[multibackendarchitecture]]></category>
            <dc:creator><![CDATA[Sandeep Rajbhar]]></dc:creator>
            <pubDate>Sun, 19 Dec 2021 12:50:12 GMT</pubDate>
            <atom:updated>2021-12-19T12:50:12.771Z</atom:updated>
            <content:encoded><![CDATA[<h3>Problem statement:</h3><p>We got a use case to create a mobile app for a client having multiple backends for different clients and having a different theme of the app. We are not sure what kinda data will be coming to the mobile app from different servers as XML or JSON.</p><h3>Challenge:</h3><p>The least change is at the business layer and service layer of the mobile app.</p><h3>The solution is <strong>Graph QL</strong>:</h3><p>The <strong>Graph QL</strong> is a query language for APIs and a runtime for fulfilling those queries with Application existing data. Graph QL is a medium to interact with the apollo client and apollo server.</p><p>The theme app will have an apollo client in a mobile app that will interact with the apollo server.</p><p>Apollo server will have the responsibility to switch the backend and call the required backend system out of either making query to the API’s or calling database or calling existing apollo server.</p><p>The switching can happen in two ways.</p><ul><li>The Apollo client will register a different apollo server as per the app which calls a single backend system with respect to each client app</li></ul><pre>// Initialize Apollo Client<br>const client = new ApolloClient({<br>  uri: &#39;https://api.example.com&#39;, // change apolo server as per //client<br>  cache: new InMemoryCache()<br>});<br><br>const App = () =&gt; (<br>  &lt;ApolloProvider client={client}&gt;<br>    &lt;MyRootComponent /&gt;<br>  &lt;/ApolloProvider&gt;<br>);</pre><ul><li>The Apollo client will send a different flag (to differentiate between themes of the mobile app ) to a single apollo server and the apollo server will have logic to redirect the query to a specific backend as per the flag.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TzUF-Q8jgdWdoWD_d_uVRQ.png" /></figure><p>Some of the concerns and their solution while using GraphQL mentioned below,</p><p><strong><em>Authentication:</em></strong></p><ul><li>App authentication implementation should eventually provide the current user to the resolvers</li><li>Graph QL resolvers should not know about the authentication logic (separation between the business logic and the authentication logic)</li><li>App wishes to protect only parts of your GraphQL schema and not all of it.</li><li>App wants to be able to authenticate parts of your schema, on a field level.</li></ul><p>However, Authentication can be done by sending HTTP headers and JSON web tokens by apollo link context.</p><p><strong><em>Authorization:</em></strong></p><ul><li>App wishes to protect some fields, according to custom rules.</li><li>App wishes to run custom logics that protect parts of your GraphQL schema.</li><li>Our custom rules should not be coupled to a specific resolver.</li></ul><p>However, Authorization should be done on the server-side itself in the case of third-party APIs or servers. In the case of dealing with the database, a resolver should implement permission checks on the level of the node.</p><p><strong><em>How does the Apollo client manage the cache?</em></strong></p><p>Apollo Client uses a normalized, in-memory cache to dramatically speed up the execution of queries that don’t rely on real-time data.</p><p>The InMemoryCache normalizes query results before saving them to the cache by:</p><ul><li>Splitting the results into individual objects</li><li>Assigning a unique identifier to each object</li><li>Storing the objects in a flattened data structure</li></ul><p><strong>Syncing with the Server</strong></p><p>Apollo Client caches the results of queries and then uses this cache to resolve queries when possible. You can control this behavior with the fetch policy you use when asking for query data.</p><p>There are a few strategies you can implement to make sure that Apollo Client is eventually consistent with the information available to your server.</p><p><strong><em>Refetch:</em></strong></p><p>Refetches are the simplest way to force a portion of your cache to reflect the information available to your server. Essentially, a refetch forces a query to immediately hit the server again, bypassing the cache. The result of this query, just like all other query results, updates the information available in the cache, which updates all of the query results on the page.</p><p><strong>When to refetch?</strong></p><p>In order for <strong>refetch</strong> to be a viable strategy, you need to know when to refetch a query. There are a few different use cases where <strong>refetching</strong> makes sense.</p><ul><li><strong>Manual refresh:</strong> Many apps have a way for the user to manually request an updated view of their data, via a refresh button or pull-down gesture. refetch is perfectly suited for this case.</li><li><strong>In response to the event:</strong> Sometimes, you know when an event has happened that might invalidate data. For example, you might have some sort of event pushing that tells you when data might have changed. Then, a refetch can be the best way to avoid polling unnecessarily.</li><li><strong>After a mutation:</strong> There are several ways to make sure the store is up to date after a mutation, but the easiest way is to do a full refetch of the relevant queries. In this case, in addition to using the refetch method on the query itself, you can also use the refetchQueries options on the mutation.</li></ul><p><strong>Polling</strong></p><p>If you have a query whose results can change frequently, and you want to be looking at a fresh view of the world, it makes sense to consider making a polling query. A polling query is fired on a particular time interval but otherwise works similarly to a refetch.</p><p><strong>Subscriptions</strong></p><p>Get real-time updates from your GraphQL server with help of subscriptions. Subscriptions are useful for notifying clients in real-time about changes to back-end data, such as the creation of a new object or updates to an important field.</p><p>In most cases, The Apollo client app should not use subscriptions to stay up to date with the current backend. Instead, we should poll intermittently with queries, or re-execute queries on demand when a user performs a relevant action (such as clicking a button).</p><p><strong>We should use subscriptions for the following:</strong></p><ul><li>Small, incremental changes to large objects. Repeatedly polling for a large object is expensive, especially when most of the object’s fields rarely change. Instead, you can fetch the object’s initial state with a query, and your server can proactively push updates to individual fields as they occur.</li><li>Low-latency, real-time updates. For example, a chat application’s client wants to receive new messages as soon as they are available.</li></ul><p><strong><em>Security Factor:</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KnrmgvroutARD9tJ_NwMPA.png" /></figure><p><strong><em>Risk Factor :</em></strong></p><ul><li>Performance issues with complex queries.</li><li>Overkill for small applications.</li><li>Web caching complexity</li><li>SSL Pinning is not available from GRAPH QL Directly. we have to use additional packages or third parties for SSL Pinning in React native.</li></ul><p><strong>Why React Native App with Redux and Redux Observable:</strong></p><p>For this, I will write a different article and many are floating online. So I will not go on that. My main focus was Graph QL to support multi-backend architecture.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4391f7d7f3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Commercetools + Node JS]]></title>
            <link>https://sandeeprajbhartechgeek.medium.com/getting-started-with-commercetools-node-js-8270b0083e30?source=rss-e15528188805------2</link>
            <guid isPermaLink="false">https://medium.com/p/8270b0083e30</guid>
            <category><![CDATA[commercetools]]></category>
            <category><![CDATA[digital]]></category>
            <category><![CDATA[headless]]></category>
            <category><![CDATA[e-commerce-solution]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Sandeep Rajbhar]]></dc:creator>
            <pubDate>Fri, 17 Dec 2021 18:38:36 GMT</pubDate>
            <atom:updated>2023-10-19T05:25:11.911Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why I am writing this article?</h3><p>I was exploring the Commercetools to get a basic concept by following their tutorial <a href="https://docs.commercetools.com/tutorials/">https://docs.commercetools.com/tutorials/ </a>. The commercetools supports clients in three different languages to help you connect with the HTTP APIs i.e. JAVA client, PHP client, and Node JS client. I have found that in the tutorial most of the time they are using curl cmd to connect with the HTTP APIs or make any query (And also giving JSON structure). Since Node JS is widely used by many developers I thought to learn tutorials by using Node JS client instead of copy-pasting curl cmd. While doing this initially I found some challenges to make a query and search operation from Node JS client as it was not in the tutorial and not much available on google.</p><p>So basically this tutorial will help Node JS developers to quickly start working with Node JS clients to use Commercetools basic query and search operations.</p><p><strong><em>Prerequisite :</em></strong></p><ol><li>Register yourself with Commercetools and get 60 days of free access.</li><li>Create an API client on the merchant center (easy step already given <a href="https://docs.commercetools.com/tutorials/getting-started">https://docs.commercetools.com/tutorials/getting-started</a> )</li><li>First clone and import the Sunrise data and dump it into the merchant center as per this “<a href="https://github.com/commercetools/commercetools-sunrise-data">https://github.com/commercetools/commercetools-sunrise-data</a>” GitHub tutorial.</li><li>Save the “env.commercetoolspoc_credentials” in some folder and later convert to .env file and put inside the project. It has all the basic information about clients and security keys. (these steps you must have already covered in step 3)</li><li>Once you have set up the project create a new empty project by cmd npm init -y</li><li>After this install a few imp packages as npm install @commercetools/sdk-client @commercetools/sdk-middleware-auth @commercetools/sdk-middleware-http @commercetools/api-request-builder dotenv</li><li>Create a new file called project.js in this directory.</li></ol><p>Now let&#39;s see one by one how we can use Node JS client,</p><p><strong>Client Setup and authorization: </strong>add the following code in project.js</p><blockquote>const { createClient } = require(‘@commercetools/sdk-client’)</blockquote><blockquote>const { createRequestBuilder, features } = require(‘@commercetools/api-request-builder’)</blockquote><blockquote>const { createAuthMiddlewareForClientCredentialsFlow } = require(‘@commercetools/sdk-middleware-auth’)</blockquote><blockquote>const { createHttpMiddleware } = require(‘@commercetools/sdk-middleware-http’)</blockquote><blockquote>const { SdkAuth } = require(‘@commercetools/sdk-auth’)</blockquote><blockquote>const fetch = require(‘node-fetch’)</blockquote><blockquote>require(‘dotenv’).config()</blockquote><blockquote>console.log(‘Getting started with commercetools Nodejs SDK’);</blockquote><blockquote>const {</blockquote><blockquote>CTP_CLIENT_ID,</blockquote><blockquote>CTP_CLIENT_SECRET,</blockquote><blockquote>CTP_PROJECT_KEY,</blockquote><blockquote>CTP_API_URL,</blockquote><blockquote>CTP_AUTH_URL,</blockquote><blockquote>CTP_SCOPES</blockquote><blockquote>} = process.env;</blockquote><blockquote>const projectKey = CTP_PROJECT_KEY</blockquote><blockquote>// Create a httpMiddleware for the your project AUTH URL</blockquote><blockquote>const authMiddleware = createAuthMiddlewareForClientCredentialsFlow({</blockquote><blockquote>host: CTP_AUTH_URL,</blockquote><blockquote>projectKey,</blockquote><blockquote>credentials: {</blockquote><blockquote>clientId: CTP_CLIENT_ID,</blockquote><blockquote>clientSecret: CTP_CLIENT_SECRET,</blockquote><blockquote>},</blockquote><blockquote>scopes: [CTP_SCOPES],</blockquote><blockquote>fetch,</blockquote><blockquote>})</blockquote><blockquote>// Create a httpMiddleware for the your project API URL</blockquote><blockquote>const httpMiddleware = createHttpMiddleware({</blockquote><blockquote>host: CTP_API_URL,</blockquote><blockquote>fetch,</blockquote><blockquote>})</blockquote><blockquote>// Create a client using authMiddleware and httpMiddleware</blockquote><blockquote>const client = createClient({</blockquote><blockquote>middlewares: [authMiddleware, httpMiddleware],</blockquote><blockquote>})</blockquote><p><strong>Get Project Information :</strong></p><blockquote>// Create a request builder for the project</blockquote><blockquote>const projectService = createRequestBuilder({ projectKey }).project;</blockquote><blockquote>// Create a request to get project information</blockquote><blockquote>const createGetProjectRequest = {</blockquote><blockquote>uri: projectService.build(),</blockquote><blockquote>method: ‘GET’,</blockquote><blockquote>};</blockquote><blockquote>(async () =&gt; {</blockquote><blockquote>try {</blockquote><blockquote>// Use the `client.execute` method to send a message from this app</blockquote><blockquote>await client.execute(createGetProjectRequest)</blockquote><blockquote>.then(data =&gt; {</blockquote><blockquote>console.log(‘Project information — -&gt;’, data);</blockquote><blockquote>})</blockquote><blockquote>.catch(error =&gt; {</blockquote><blockquote>console.log(‘ERROR — -&gt;’, error);</blockquote><blockquote>})</blockquote><blockquote>} catch (error) {</blockquote><blockquote>console.log(‘ERROR — -&gt;’, error);</blockquote><blockquote>}</blockquote><blockquote>//console.log(‘Got project information’);</blockquote><blockquote>})()</blockquote><p><strong>User Information:</strong></p><blockquote>// user Information</blockquote><blockquote>const usersOptions = {</blockquote><blockquote>projectKey,</blockquote><blockquote>customServices: {</blockquote><blockquote>users: {</blockquote><blockquote>type: ‘users’,</blockquote><blockquote>endpoint: ‘/users’,</blockquote><blockquote>features: [features.query, features.queryOne],</blockquote><blockquote>},</blockquote><blockquote>},</blockquote><blockquote>}</blockquote><blockquote>const requestBuilder = createRequestBuilder(usersOptions)</blockquote><blockquote>const uriUsers = requestBuilder.productProjections.build()</blockquote><blockquote>// Create a request to get users information</blockquote><blockquote>const createGetUsersRequest = {</blockquote><blockquote>uri : uriUsers,</blockquote><blockquote>method: ‘GET’,</blockquote><blockquote>};</blockquote><blockquote>(async () =&gt; {</blockquote><blockquote>try {</blockquote><blockquote>// Use the `client.execute` method to send a message from this app</blockquote><blockquote>await client.execute(createGetUsersRequest)</blockquote><blockquote>.then(data =&gt; {</blockquote><blockquote>console.log(‘Users information — -&gt;’, data);</blockquote><blockquote>})</blockquote><blockquote>.catch(error =&gt; {</blockquote><blockquote>console.log(‘ERROR — -&gt;’, error);</blockquote><blockquote>})</blockquote><blockquote>} catch (error) {</blockquote><blockquote>console.log(‘ERROR — -&gt;’, error);</blockquote><blockquote>}</blockquote><blockquote>//console.log(‘Got project information’);</blockquote><blockquote>})()</blockquote><p><strong>Product Information:</strong></p><blockquote>const productOptions = {</blockquote><blockquote>projectKey,</blockquote><blockquote>customServices: {</blockquote><blockquote>products: {</blockquote><blockquote>type: ‘products’,</blockquote><blockquote>endpoint: ‘/products’,</blockquote><blockquote>features: [features.query, features.queryOne, features.create, features.update, features.del, features.search],</blockquote><blockquote>},</blockquote><blockquote>},</blockquote><blockquote>}</blockquote><blockquote>const requestBuilderProduct = createRequestBuilder(productOptions)</blockquote><blockquote>const uriProduct = requestBuilderProduct.products.build() // product list</blockquote><blockquote>// Create a request to get Product information</blockquote><blockquote>const createGetProductRequest = {</blockquote><blockquote>uri: uriProduct,</blockquote><blockquote>method: ‘GET’,</blockquote><blockquote>};</blockquote><blockquote>(async () =&gt; {</blockquote><blockquote>try {</blockquote><blockquote>// Use the `client.execute` method to send a message from this app</blockquote><blockquote>await client.execute(createGetProductRequest)</blockquote><blockquote>.then(data =&gt; {</blockquote><blockquote>//console.log(‘Product info — -&gt;’, data.body.masterData.current.name.en);</blockquote><blockquote>// console.log(‘Product info — -&gt;’, data.body.results);</blockquote><blockquote>console.log(‘Product info — -&gt;’, data.body.results[0]);</blockquote><blockquote>})</blockquote><blockquote>.catch(error =&gt; {</blockquote><blockquote>console.log(‘ERROR — -&gt;’, error);</blockquote><blockquote>})</blockquote><blockquote>} catch (error) {</blockquote><blockquote>console.log(‘ERROR — -&gt;’, error);</blockquote><blockquote>}</blockquote><blockquote>console.log(‘\n …………………….\n’);</blockquote><blockquote>})()</blockquote><p><strong>Product by ID :</strong></p><blockquote>/ Product Information by ID</blockquote><blockquote>const productOptions = {</blockquote><blockquote>projectKey,</blockquote><blockquote>customServices: {</blockquote><blockquote>products: {</blockquote><blockquote>type: ‘products’,</blockquote><blockquote>endpoint: ‘/products’,</blockquote><blockquote>features: [features.query, features.queryOne, features.create, features.update, features.del, features.search],</blockquote><blockquote>},</blockquote><blockquote>},</blockquote><blockquote>}</blockquote><blockquote>const requestBuilderProduct = createRequestBuilder(productOptions)</blockquote><blockquote>const uriProduct = requestBuilderProduct.products.byId(‘7fb2c082–8383–467f-b19f-8c20eae6c090’).build() // product by ID</blockquote><blockquote>// Create a request to get Product information</blockquote><blockquote>const createGetProductRequest = {</blockquote><blockquote>uri: uriProduct,</blockquote><blockquote>method: ‘GET’,</blockquote><blockquote>};</blockquote><blockquote>(async () =&gt; {</blockquote><blockquote>try {</blockquote><blockquote>// Use the `client.execute` method to send a message from this app</blockquote><blockquote>await client.execute(createGetProductRequest)</blockquote><blockquote>.then(data =&gt; {</blockquote><blockquote>console.log(‘Product info — -&gt;’, data.body);</blockquote><blockquote>})</blockquote><blockquote>.catch(error =&gt; {</blockquote><blockquote>console.log(‘ERROR — -&gt;’, error);</blockquote><blockquote>})</blockquote><blockquote>} catch (error) {</blockquote><blockquote>console.log(‘ERROR — -&gt;’, error);</blockquote><blockquote>}</blockquote><blockquote>console.log(‘\n …………………….\n’);</blockquote><blockquote>})()</blockquote><p><strong>Product projection search :</strong></p><blockquote>const productProjectionsOptions = {</blockquote><blockquote>projectKey,</blockquote><blockquote>customServices: {</blockquote><blockquote>productProjections: {</blockquote><blockquote>type: ‘productProjections’,</blockquote><blockquote>endpoint: ‘/productProjections’,</blockquote><blockquote>features: [features.query, features.queryOne, features.projection, features.queryExpand],</blockquote><blockquote>},</blockquote><blockquote>},</blockquote><blockquote>}</blockquote><blockquote>const requestBuilderProductProjections = createRequestBuilder(productProjectionsOptions)</blockquote><blockquote>const uriProduct = requestBuilderProductProjections.productProjectionsSearch</blockquote><blockquote>.parse({</blockquote><blockquote>text: {language :”en”, value:”Sandeep Rajbhar”}, // try with this value also msut see some array list“elisabetta-franchi-dress-ab8953866-silver”</blockquote><blockquote>fuzzy: false,</blockquote><blockquote>markMatchingVariants: true</blockquote><blockquote>})</blockquote><blockquote>.build() // Projections Search. product</blockquote><blockquote>// Create a request to get Product information</blockquote><blockquote>const createGetProductProjectionsSearchRequest = {</blockquote><blockquote>uri: uriProduct,</blockquote><blockquote>method: ‘GET’,</blockquote><blockquote>};</blockquote><blockquote>(async () =&gt; {</blockquote><blockquote>try {</blockquote><blockquote>// Use the `client.execute` method to send a message from this app</blockquote><blockquote>await client.execute(createGetProductProjectionsSearchRequest)</blockquote><blockquote>.then(data =&gt; {</blockquote><blockquote>console.log(‘Product Product Projections Search info — -&gt;’, data.body);</blockquote><blockquote>})</blockquote><blockquote>.catch(error =&gt; {</blockquote><blockquote>console.log(‘ERROR — -&gt;’, error);</blockquote><blockquote>})</blockquote><blockquote>} catch (error) {</blockquote><blockquote>console.log(‘ERROR — -&gt;’, error);</blockquote><blockquote>}</blockquote><blockquote>console.log(‘\n …………………….\n’);</blockquote><blockquote>})()</blockquote><p><strong>Category Information with Query feature “where” with the imperative and declarative search :</strong></p><blockquote>const categoryOptions = {</blockquote><blockquote>projectKey,</blockquote><blockquote>customServices: {</blockquote><blockquote>categories: {</blockquote><blockquote>type: ‘categories’,</blockquote><blockquote>endpoint: ‘/categories’,</blockquote><blockquote>features: [features.query, features.queryOne],</blockquote><blockquote>},</blockquote><blockquote>},</blockquote><blockquote>}</blockquote><blockquote>const requestBuilderCat = createRequestBuilder(categoryOptions)</blockquote><blockquote>//const uriCat = requestBuilderCat.categories.build() // categories list</blockquote><blockquote>//const uriCat = requestBuilderCat.categories.withTotal(false).build() // categories list with no total info</blockquote><blockquote>// const uriCat = requestBuilderCat.categories</blockquote><blockquote>// .where(‘key = “c8”’)</blockquote><blockquote>// .perPage(1)</blockquote><blockquote>// .withVersion(3)</blockquote><blockquote>// .build() // imperative</blockquote><blockquote>const uriCat = requestBuilderCat.categories</blockquote><blockquote>.parse({</blockquote><blockquote>where: [‘key = “c7”’],</blockquote><blockquote>perPage: 1,</blockquote><blockquote>version: 3,</blockquote><blockquote>})</blockquote><blockquote>.build() // declarative can be used mix also.</blockquote><blockquote>// Create a request to get Product information</blockquote><blockquote>const createGetCatRequest = {</blockquote><blockquote>uri: uriCat,</blockquote><blockquote>method: ‘GET’,</blockquote><blockquote>};</blockquote><blockquote>(async () =&gt; {</blockquote><blockquote>try {</blockquote><blockquote>// Use the `client.execute` method to send a message from this app</blockquote><blockquote>await client.execute(createGetCatRequest)</blockquote><blockquote>.then(data =&gt; {</blockquote><blockquote>//console.log(‘Cat info — -&gt;’, data.body.masterData.current.name.en);</blockquote><blockquote>console.log(‘Cat info — -&gt;’, data.body.results[0]);</blockquote><blockquote>})</blockquote><blockquote>.catch(error =&gt; {</blockquote><blockquote>console.log(‘ERROR — -&gt;’, error);</blockquote><blockquote>})</blockquote><blockquote>} catch (error) {</blockquote><blockquote>console.log(‘ERROR — -&gt;’, error);</blockquote><blockquote>}</blockquote><blockquote>console.log(‘\n …………………….\n’);</blockquote><blockquote>})()</blockquote><p><strong>Add Custom field to the customer :</strong></p><blockquote>const typeOptions = {</blockquote><blockquote>projectKey,</blockquote><blockquote>customServices: {</blockquote><blockquote>types: {</blockquote><blockquote>type: ‘types’,</blockquote><blockquote>endpoint: ‘/types’,</blockquote><blockquote>features: [features.query, features.queryOne, features.create],</blockquote><blockquote>},</blockquote><blockquote>},</blockquote><blockquote>}</blockquote><blockquote>const requestBuilderType = createRequestBuilder(typeOptions)</blockquote><blockquote>const uriType = requestBuilderType.types.build() // declarative can be used mix also.</blockquote><blockquote>const data = {</blockquote><blockquote>“key”: “customer-preferredShoeSize”,</blockquote><blockquote>“name”: {</blockquote><blockquote>“en”: “Additional field to store preferred shoe size”</blockquote><blockquote>},</blockquote><blockquote>“resourceTypeIds”: [“customer”],</blockquote><blockquote>“fieldDefinitions”: [{</blockquote><blockquote>“type”: {</blockquote><blockquote>“name”: “LocalizedString”</blockquote><blockquote>},</blockquote><blockquote>“name”: “preferredShoeSize”,</blockquote><blockquote>“label”: {</blockquote><blockquote>“en”: “Preferred Shoe Size”</blockquote><blockquote>},</blockquote><blockquote>“required”: false,</blockquote><blockquote>“inputHint”: “SingleLine”</blockquote><blockquote>}]</blockquote><blockquote>}</blockquote><blockquote>// Create a request to get Product information</blockquote><blockquote>const createTypeRequest = {</blockquote><blockquote>uri: uriType,</blockquote><blockquote>method: ‘POST’,</blockquote><blockquote>body: data</blockquote><blockquote>};</blockquote><blockquote>(async () =&gt; {</blockquote><blockquote>try {</blockquote><blockquote>// Use the `client.execute` method to send a message from this app</blockquote><blockquote>await client.execute(createTypeRequest)</blockquote><blockquote>.then(data =&gt; {</blockquote><blockquote>//console.log(‘Product info — -&gt;’, data.body.masterData.current.name.en);</blockquote><blockquote>console.log(‘Type info — -&gt;’, data);</blockquote><blockquote>})</blockquote><blockquote>.catch(error =&gt; {</blockquote><blockquote>console.log(‘ERROR — -&gt;’, error);</blockquote><blockquote>})</blockquote><blockquote>} catch (error) {</blockquote><blockquote>console.log(‘ERROR — -&gt;’, error);</blockquote><blockquote>}</blockquote><blockquote>console.log(‘\n …………………….\n’);</blockquote><blockquote>})()</blockquote><p><strong>Creating a Customer with the preferredShoeSize CustomField:</strong></p><blockquote>const customerCustomTypeOptions = {</blockquote><blockquote>projectKey,</blockquote><blockquote>customServices: {</blockquote><blockquote>customers: {</blockquote><blockquote>type: ‘customers’,</blockquote><blockquote>endpoint: ‘/customers’,</blockquote><blockquote>features: [features.query, features.queryOne, features.create],</blockquote><blockquote>},</blockquote><blockquote>},</blockquote><blockquote>}</blockquote><blockquote>const requestBuilderType = createRequestBuilder(customerCustomTypeOptions)</blockquote><blockquote>const uriType = requestBuilderType.customers.build();</blockquote><blockquote>const data = {</blockquote><blockquote>“customerNumber”: “1000000000”,</blockquote><blockquote>“email”: “ShrihariOm@example.com”,</blockquote><blockquote>“firstName”: “Hari”,</blockquote><blockquote>“lastName”: “Om”,</blockquote><blockquote>“password”: “secret123”,</blockquote><blockquote>“custom”: {</blockquote><blockquote>“type”: {</blockquote><blockquote>“key”: “customer-preferredShoeSize”,</blockquote><blockquote>“typeId”: “type”</blockquote><blockquote>},</blockquote><blockquote>“fields”: {</blockquote><blockquote>“preferredShoeSize”: {</blockquote><blockquote>“en”: “38”</blockquote><blockquote>}</blockquote><blockquote>}</blockquote><blockquote>}</blockquote><blockquote>}</blockquote><blockquote>// Create a request to get Product information</blockquote><blockquote>const createCustomCustomerRequest = {</blockquote><blockquote>uri: uriType,</blockquote><blockquote>method: ‘POST’,</blockquote><blockquote>body: data</blockquote><blockquote>};</blockquote><blockquote>(async () =&gt; {</blockquote><blockquote>try {</blockquote><blockquote>// Use the `client.execute` method to send a message from this app</blockquote><blockquote>await client.execute(createCustomCustomerRequest)</blockquote><blockquote>.then(data =&gt; {</blockquote><blockquote>//console.log(‘Product info — -&gt;’, data.body.masterData.current.name.en);</blockquote><blockquote>console.log(‘New Custom customer info — -&gt;’, data);</blockquote><blockquote>console.log(‘ \n Custom field — -&gt;’, data.body.customer.custom);</blockquote><blockquote>})</blockquote><blockquote>.catch(error =&gt; {</blockquote><blockquote>console.log(‘ERROR — -&gt;’, error);</blockquote><blockquote>})</blockquote><blockquote>} catch (error) {</blockquote><blockquote>console.log(‘ERROR — -&gt;’, error);</blockquote><blockquote>}</blockquote><blockquote>console.log(‘\n …………………….\n’);</blockquote><blockquote>})()</blockquote><p>Run “nodemon project.js” cmd to run and see the output one by one.</p><p>Thanks so much, guys!!!!</p><p><a href="https://www.youtube.com/watch?v=4Tm84y44yC4&amp;ab_channel=VueStorefront">https://www.youtube.com/watch?v=4Tm84y44yC4&amp;ab_channel=VueStorefront</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8270b0083e30" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[End to End CI/CD pipeline Setup with Azure DevOps for Mobile App: IOS — Part1]]></title>
            <link>https://sandeeprajbhartechgeek.medium.com/end-to-end-ci-cd-pipeline-setup-with-azure-devops-for-mobile-app-ios-part1-6da0cdb7eb17?source=rss-e15528188805------2</link>
            <guid isPermaLink="false">https://medium.com/p/6da0cdb7eb17</guid>
            <category><![CDATA[app-store]]></category>
            <category><![CDATA[mobile-app-deployment]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[azure-devops]]></category>
            <dc:creator><![CDATA[Sandeep Rajbhar]]></dc:creator>
            <pubDate>Fri, 10 Dec 2021 09:02:24 GMT</pubDate>
            <atom:updated>2023-10-11T06:25:10.308Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>End to End </strong>CI/CD pipeline Setup with Azure DevOps for <strong>Mobile App: </strong>IOS — Part1.</h3><h3><strong><em>Why I am writing this article?</em></strong></h3><p>For one of the clients, I wanted to set up a CI/CD pipeline automation for a Mobile app for both IOS and Android for react native app. I faced some of the issues between setting up the pipeline. So I thought to write the article for all of you to not only set up the Pipeline but also get inside and understand common errors and logs. So there is a total of 5 parts in this series and we will go one by one.</p><p><strong><em>Once you will finish all these steps you will be a MASTER of CICD azure DevOps setup for Mobile apps. Thanks, me later :D.</em></strong></p><p>Please follow these steps to create CI/CD pipeline for react native iOS app on Azure DevOps. This will help to auto-create an IPA and deploy the app on TestFlight.</p><p><strong><em>Prerequisite</em></strong></p><ul><li>The developer has basic knowledge of deploying an app to the app store manually.</li><li>Organization and project already created a user have the access to the project.</li><li>The app is already created on the app store with all the configurations needed to upload the build.</li><li>The first version of the app has been already uploaded to the app store and the tester can test it via test flight.</li><li>The P12 file and provision profile are already available as per bundle ID.</li><li>Apple account credential and access as Admin.</li></ul><ol><li>Go to project -&gt; Select pipeline -&gt; New pipeline -&gt; Select “Use the classical editor”</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rozu0ZpxxKVOdYZ9Gqs5-Q.png" /></figure><p>2. Select Azure repo git -&gt; Repo -&gt; Branch -&gt; Continue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2ikQUNFCzRHjGPhczNQzCg.png" /></figure><p>3. Search for XCode and select</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4O2l6XAkcSmp2e2q5QwtPA.png" /></figure><p>4. Above step will create a default Pipeline with some jobs. We need only a few jobs out of that as per our requirement and delete the other job. Also, add one more job as “Apple app store release” we will use this to deploy the app to TestFlight.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*BDHPuTa0panSd3EsmYg5rA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*jYopBPdL3hgWkh7XTRhmPA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NSzijR2bICzOTYiXkuWMFw.png" /></figure><p>5. Select the “Get Sources” and do the setup as mentioned in the below screenshot. A select branch from where you want to create a build.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*QHKDeKjUYhQcXQ50XJkC6w.png" /></figure><p>6. Create Agent and give some names. Select the macOS as we will create an IPA file and build the code on the agent machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*51JGo7S_olzrQnQUzD0YfQ.png" /></figure><p>7. Install an apple certificate. We are assuming the developer already has a p12 certificate and provisioning profile.</p><p><em>a) Select the “Install apple certificate”.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*txKA0SeLVIs-YiQqpUJAEQ.png" /></figure><p><em>b) Go to Library -&gt; Secure file -&gt; Add p12 and provisioning file in the secure file tab. We need to add a different PP for different app/bundle ID to have multiple apps.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y4CRkVFtdV8VoC-oh8Sy2g.jpeg" /></figure><p>c) Select the added p12 file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*W2TgfC9ihHmvNO0w8DZpMQ.png" /></figure><p>d) Go to Variables tab in Pipeline -&gt; Select Pipeline variables-&gt; add “P12password” variable and assign value of password of file -&gt; Mention name of p12 file password as “$(P12password)” in ‘Certificate (P12) password’. -&gt; Enable control option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AGKLH-EEKIYsgLzRHjYvKg.png" /></figure><p>8. Install an Apple provisioning profile -&gt; Select PP added in the previous step inside files. -&gt; Enable control option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jq6rE_I5_zHqtUhENkfRvw.png" /></figure><p>9. XCode Build -&gt; Select all the options as mentioned below screenshot. Few options are already provided by the job. This will create an IPA file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*Kyz63_4M_mJdEHeoqYFssw.png" /></figure><p>a)</p><ul><li>$(Configuration) is a dynamic variable we need to add value in a variable tab like “Release” or “UAT_QualityGateTest.Release” which should have exact same name of configuration created in XCode.( As of now for POC we have created two configurations with scheme names “QualityGateTest” relate to the master branch and “UAT_QualityGateTest” relate to UAT).</li><li>Change the scheme name as per the associated configuration name.</li><li>Add SDK variable in variable tab with value “iphoneos”. Which will be part of the folder structure when IPA will create.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WE39lWqvQLxnE6Ib4AOJwg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*ADF9ZCPUmrPjDNRNQQorAQ.png" /></figure><p>b)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*5I2wOUVNoTGeWHgrkhD4zg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3HglKzld_1VtL0mDJ9Lfhw.png" /></figure><p>10. Copy Files to: $(build.artifactstagingdirectory) -&gt; Most are default option keep as it is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*OjyCM9hg7AnPVCYDELguAA.png" /></figure><p>11. Publish Artifact: drop -&gt; Select all the options as mentioned in the below screenshot. Most are default options keep as it is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yE_0ihrqdW7ZXoTXGA_5uA.png" /></figure><p>12. Publish to the App Store TestFlight track (Directly from the Pipeline by adding Job)</p><p><em>a. Select the Username and password as the authentication method and provide detail -&gt; Must select the Two-Factor authentication.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r6gpS0kLhHaPeon_FQhC4Q.png" /></figure><p><em>b. Create app specific password -&gt; Go to </em><a href="https://appleid.apple.com/account/manage"><em>https://appleid.apple.com/account/manage</em></a><em> -&gt; Login with apple ID -&gt; Create app specific password. -&gt; Store that into Pipeline variable (like step 7.d) by name of “FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*_wKVmIP5cMTZgkMULR9I3w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CeMcgCMyJ_FD34kJDJ3wgA.png" /></figure><p>c. <em>Create Fastlane Session for Two-step Verification -&gt; Go to terminal -&gt; run cmd “fastlane spaceauth -u [email]” and input the required detail.-&gt; Copy the session -&gt; link to the option “Create Fastlane Session for Two-step”.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pn2HHdcsWmgYg9pYm2AoOg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*-OKJ4WnuLfAvj1wXX7WfqA.png" /></figure><p><em>d. Select the rest of the options as per the below screenshot.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B5KioLNJ6YKWA0jCu-a-Rg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*4nAIYvNLupeoFcEU9d7jSg.png" /></figure><p>13. Final configuration of the pipeline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*8h0JhFjlw_gC5TwByPBMiw.png" /></figure><p>14. Change the version number or build number in the XCode project and commit to the branch. Run the pipeline.</p><p>15. The final successful pipeline should look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4pnjlH9oDfBFodR-vo4VaA.png" /></figure><p>16. Final successful Appstore upload of IPA will look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*91g0Hrtkm3pdhvWIUVQI-Q.png" /></figure><p><strong>NOTE:</strong></p><ul><li>This Part1 is for learning and understanding the basic configuration on the Azure pipeline for the IOS app. Further, we will use the YAML file to create a build as per branch trigger and release pipeline to handle dynamic builds. This we will cover in the build strategy article in further parts.</li><li>We can autorun the pipeline by setting an option in the trigger tab of Pipeline but as of now, this is for manual CI/CD with a single branch. For multiple branches and auto-trigger, we will cover that in-branch strategy article.</li></ul><p>Wait for the next article on <strong>“End to End CI/CD pipeline Setup with Azure DevOps for Mobile App: Android— Part2”</strong></p><p>Thanks so much, guys!!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6da0cdb7eb17" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sonar cloud integration with Github repository for React Native App — Part 2.]]></title>
            <link>https://sandeeprajbhartechgeek.medium.com/sonar-cloud-integration-with-github-repository-for-react-native-app-part-2-9d08e94a6da5?source=rss-e15528188805------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d08e94a6da5</guid>
            <category><![CDATA[sonarcloud]]></category>
            <category><![CDATA[quality-gate]]></category>
            <category><![CDATA[pipeline]]></category>
            <category><![CDATA[code-clean-up]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Sandeep Rajbhar]]></dc:creator>
            <pubDate>Thu, 04 Mar 2021 03:33:19 GMT</pubDate>
            <atom:updated>2021-03-04T03:33:19.607Z</atom:updated>
            <content:encoded><![CDATA[<h3>Sonar cloud integration with Github repository for React Native App — Part 2.</h3><p>So as per part 1, we still need to create a code coverage report and show value on the QualityGate result and overview. In this part, we will cover how to do that along with a basic understanding of the properties.</p><ol><li>If you want to exclude some from files form your project like you don’t want the Quality Gate to Scan it or analyze it, please add this property in <strong>sonar-project.properties</strong> file e.g usually we don’t want Sonar Cloud to scan or analyze iOS or android folder so for that add this property in that file and push that change on Github.</li></ol><blockquote>sonar.coverage.exclusions=**/android/**/*.*,**/ios/**/*.* (this will remove this files / folders from coverage)</blockquote><blockquote>sonar.exclusions=**/android/**/*.*,**/ios/**/*.* (this will remove this files / folders from analysis)</blockquote><p>2. By default the Sonar Cloud does not scan <strong>jsx or tsx</strong> files, So in order to enable you to need to add a property in <strong>sonar-project.properties </strong>file, add the below line and push the code in your repository</p><blockquote>sonar.javascript.file.suffixes=.js,.jsx</blockquote><blockquote>sonar.typescript.file.suffixes=.ts,.tsx</blockquote><p><strong>Code Coverage display to QualityGate.</strong></p><p>By default, the Sonar cloud does not give a report about the code coverage. We need manually add a property and write a test case in Jest, enzyme, and generated report get integrated with the Sonar cloud.</p><p>a) Add below property (some property added just to avoid some files in coverage that are not needed) in sonar-project.properties.</p><blockquote>sonar.sources=.</blockquote><blockquote>sonar.exclusions=**/__tests__/*.tsx , **/coverage/**/*.js,**/setupTests.ts,**/babel.config.js,**/index.js, **/metro.config.js, **/App.tsx</blockquote><blockquote>sonar.language=js,jsx,ts,tsx</blockquote><blockquote>sonar.tests=./__tests__</blockquote><blockquote>sonar.javascript.lcov.reportPaths=./coverage/lcov.info</blockquote><blockquote>sonar.testExecutionReportPaths=./test-report.xml</blockquote><blockquote>sonar.sourceEncoding=UTF-8</blockquote><p>b) Add main.yml file to GitHub / workflow in your project root,</p><blockquote>on:</blockquote><blockquote># Trigger analysis when pushing in master or pull requests, and when creating</blockquote><blockquote># a pull request.</blockquote><blockquote>push:</blockquote><blockquote>branches:</blockquote><blockquote>- master</blockquote><blockquote>pull_request:</blockquote><blockquote>types: [opened, synchronize, reopened]</blockquote><blockquote>name: Main Workflow</blockquote><blockquote>jobs:</blockquote><blockquote>sonarcloud:</blockquote><blockquote>runs-on: ubuntu-latest</blockquote><blockquote>steps:</blockquote><blockquote>- uses: actions/checkout@v2</blockquote><blockquote>with:</blockquote><blockquote>fetch-depth: 0</blockquote><blockquote>- name: Get master</blockquote><blockquote>run: git fetch origin master</blockquote><blockquote>- name: Install dependencies</blockquote><blockquote>run: npm install</blockquote><blockquote>- name: Install Jest globally</blockquote><blockquote>run: sudo npm install -g jest</blockquote><blockquote>- name: Run Tests</blockquote><blockquote>run: npm run test</blockquote><blockquote>- name: SonarCloud Scan</blockquote><blockquote>uses: sonarsource/sonarcloud-github-action@master</blockquote><blockquote>env:</blockquote><blockquote>GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}</blockquote><blockquote>SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}</blockquote><p><strong>Test: </strong>Now test this by making a PR or Merge to master,</p><p>Quality Gate Scan for PR:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*CwqxvZI-ROJDsy9q7HghYA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*rVZRktN1HfNMDWSlGx4LWQ.png" /></figure><p>Overall report after the merge to master:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*KUIJs2wJ5LiebwV9YVDWGA.png" /><figcaption>Before</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*xvOTX-NuKd_GnKDGYOFwKg.png" /><figcaption>After</figcaption></figure><p><strong>Useful Stuff :</strong></p><p>Overall setting file code</p><blockquote>sonar.projectKey=sandeeprajbharroyalcyber_QalityGate</blockquote><blockquote>sonar.organization=sandeeprajbharroyalcyber</blockquote><blockquote>sonar.source = SonarQualityTest</blockquote><blockquote>​sonar.coverage.exclusions=**/android/**/*.*,**/ios/**/*.*,</blockquote><blockquote>​sonar.exclusions=**/android/**/*.*,**/ios/**/*.*,</blockquote><blockquote>sonar.javascript.file.suffixes=.js,.jsx,</blockquote><blockquote>sonar.typescript.file.suffixes=.ts,.tsx,</blockquote><blockquote>sonar.java.binaries=.</blockquote><blockquote>sonar.c.file.suffixes=-</blockquote><blockquote>sonar.cpp.file.suffixes=-</blockquote><blockquote>sonar.objc.file.suffixes=-</blockquote><blockquote>sonar.html.file.suffixes=-</blockquote><blockquote>sonar.css.file.suffixes=-</blockquote><blockquote>sonar.java.file.suffixes=-</blockquote><blockquote># relative paths to source directories. More details and properties are described</blockquote><blockquote># in <a href="https://sonarcloud.io/documentation/project-administration/narrowing-the-focus/">https://sonarcloud.io/documentation/project-administration/narrowing-the-focus/</a></blockquote><blockquote># follow this for code coverage intgration <a href="https://daendersby.medium.com/making-sonarcloud-play-nicely-with-jest-fa271f559024">https://daendersby.medium.com/making-sonarcloud-play-nicely-with-jest-fa271f559024</a></blockquote><blockquote>sonar.sources=.</blockquote><blockquote>sonar.exclusions=**/__tests__/*.tsx , **/coverage/**/*.js,**/setupTests.ts,**/babel.config.js,**/index.js, **/metro.config.js, **/App.tsx</blockquote><blockquote>sonar.language=js,jsx,ts,tsx</blockquote><blockquote>sonar.tests=./__tests__</blockquote><blockquote>sonar.javascript.lcov.reportPaths=./coverage/lcov.info</blockquote><blockquote>sonar.testExecutionReportPaths=./test-report.xml</blockquote><blockquote>sonar.sourceEncoding=UTF-8</blockquote><blockquote>#sonar.projectName=QalityGate</blockquote><blockquote>#sonar.projectVersion=1.0</blockquote><blockquote># Path is relative to the sonar-project.properties file. Replace “\” by “/” on Windows.</blockquote><blockquote>#sonar.sources=.</blockquote><blockquote># Encoding of the source code. Default is default system encoding</blockquote><blockquote>#sonar.sourceEncoding=UTF-8</blockquote><p><strong>Note:</strong></p><ol><li>By default, it uses Sonar way conditions i.e for quality gate condition you can also set your own conditions, please see the screenshot attached below: This is optional.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*LiJXJ_-jUyvBxVmXN1EWVg.png" /></figure><p>2. You can set a different condition for new code to be analyzed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*clJ-0L8bbGg11Vb4xZb8wg.png" /></figure><p>That&#39;s it, Guys ……. Enjoy :D.</p><p>If you have any suggestions and questions you’re free to ask and suggest.</p><p>Have a great day guys :D.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d08e94a6da5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sonar cloud integration with Github repository for React Native App — Part1.]]></title>
            <link>https://sandeeprajbhartechgeek.medium.com/sonar-cloud-integration-with-github-repository-for-react-native-app-part1-a086153590eb?source=rss-e15528188805------2</link>
            <guid isPermaLink="false">https://medium.com/p/a086153590eb</guid>
            <category><![CDATA[quality-gate]]></category>
            <category><![CDATA[code-quality]]></category>
            <category><![CDATA[sonarcloud]]></category>
            <category><![CDATA[reactnative-app]]></category>
            <category><![CDATA[pipeline]]></category>
            <dc:creator><![CDATA[Sandeep Rajbhar]]></dc:creator>
            <pubDate>Thu, 04 Mar 2021 03:02:29 GMT</pubDate>
            <atom:updated>2023-10-11T05:58:17.514Z</atom:updated>
            <content:encoded><![CDATA[<h3>Sonar cloud integration with Github repository for React Native App — Part 1.</h3><p><em>We usually come across a situation where we need to suggest a solution to improve code quality, remove code that is exposed to a security threat, day-to-day bugs in code, vulnerability, duplication, and code coverage in a new project or existing project. We usually follow a PR process to review the code but that is too time-consuming and we can miss many important checkpoints. We need to automate the PR and merge process to perform all the checks and provide the consolidated report that can be shared across all stakeholders after each release and code reviewed at the PR level itself.</em></p><p>Sonar cloud is a solution to your above requirements. I personally become a fan of this tool :D. Let’s start real work.</p><p><strong>Setup the Sonar cloud with Github:</strong></p><p>Please follow these steps to connect your GitHub repository with sonar cloud for a react native project.</p><ol><li>Open sonar cloud web site i.e. <a href="https://sonarcloud.io/">https://sonarcloud.io</a> and click on Github icon</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*Doazy1wSdb2WtRaffZo5-Q.png" /></figure><p>2. Authorize Sonar Cloud to connect with Github</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*TSgmgN0bcaNj5kdcY1TVoA.png" /></figure><p>3. Import your project from Github</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*Xws3px5-fWizRp6Tu-yf-Q.png" /></figure><p>4. Install Sonar Cloud on Github</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*LG3B1JpUA6QKYbsQhBHHfA.png" /></figure><p>5. Create an organization on Sonar Cloud</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*cavpFHLw76sxsjMXer8Xsg.png" /></figure><p>6. Choose your plan, Select a free plan for <strong>public</strong> repositories. It means your code will be shared with the sonar cloud and visible to others. Select a paid plan if want to hide a source code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*QMbsLYu7iEmMs7acV1-s-Q.png" /></figure><p>7. Select the repository you want to analyze</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*bazEBNCjAP7uEsCJH_X5Sg.png" /></figure><p>8. Choose the analysis method, select GitHub actions</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*8jbCjGhBOd0OetypwvYT4g.png" /></figure><p>9. Follow the steps provided by Sonar Cloud</p><p>a. Copy the <strong>SONAR_TOKEN </strong>and<strong> Value</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uI4p-B6G1xAsyuJRteUYsw.png" /></figure><p>b. Save the Sonar Token in Github Project -&gt; Settings -&gt; Secrets, please see the screenshot attached:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*0w86-L0K6FdgZBT1G_ivMA.png" /></figure><p>c. Create or update (if you already have) the <strong>build.yml</strong> file, Save the file in your project root directory on Github i.e -&gt; .github -&gt; workflows -&gt; build.yml you can get the .yml by following the steps from sonar cloud while setting it up, please see the screenshot attached:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*0RT4cuJE58YODSt_qPuIMA.png" /></figure><p>d. Now you need to set up the properties for Sonar Cloud in Github, Create a new file named <strong>sonar-project.properties </strong>in the root directory of your app project, Copy the setting provided by Sonar Cloud, and update your file, for reference please see the screenshot attached</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K8m9x-K-l_O7oCsPnV8otQ.png" /></figure><p>Now your project and Sonar Cloud (Github) are successfully integrated.</p><p><strong>Testing the Quality Gate :</strong></p><p>In order to test your project i.e Github synced with SonarCloud Please follow these steps:</p><p><strong><em>PR Test :</em></strong></p><ol><li>Create a new branch from <strong>master</strong> e.g named new branch <strong>demo-branch </strong>push the code on GitHub and create a Pull Request.</li><li>When a pull request is created on Github it will automatically start the quality gate check by running the pipeline specified in the build.yml file and it will show you in progress this is now synced with Sonar Cloud, running and scanning your code, pls see the screenshot below for reference.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*mGmscbaRfYEPXZ8O06Gigg.png" /></figure><p>3. Once the scanning is done it will give you result like this, if no issues it will be like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*rbivc1bHHySbJtndPgsDlw.png" /></figure><p>On Sonar Cloud it will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4fRobpmpIZSKLZoYFCzKOw.png" /></figure><p>4. If there is an issue it will be like this on the Github log for that PR.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HaVFOd3Z7K-zaPZy7ulF4A.png" /></figure><p>Click on details to get a detailed report, it will give you the link for the Sonar Cloud panel when you click on that it will report like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uLrrB0M_0km8KNgAFA5wPg.png" /></figure><p><strong><em>Merge Test :</em></strong></p><p>Merge test can be only done on a long live branch in our case it is the master branch.</p><p>Sonar cloud best works with the master branch as a default long live branch if we try to change it can create some other issue. Once you will merge the PR into the Master branch it will generate an overview report like this,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*RP8x8zWhgkhNXqCiNpb7NQ.png" /></figure><p>Finally, The basic quality gate test is done :D.</p><p><strong>What Next? Code Coverage value.</strong></p><p>If you have noticed code coverage is showing zero always for PR as well Merge. This we can not achieve directly we need more steps to do that. We need to write a unit test script, generate a report, create a new pipeline to do the code coverage as per the number of unit test done.</p><p>Go the Part -2 of this blog series for the<a href="https://sandeeprajbhartechgeek.medium.com/sonar-cloud-integration-with-github-repository-for-react-native-app-part-2-9d08e94a6da5"> Sonar cloud integration with Github repository for React Native App — Part 2.</a></p><p>If you have any suggestions and questions you’re free to ask and suggest.</p><p>Have a great day guys :D.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a086153590eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>