I'm actually new to AzureDevOps and its been two days I can't seem to find a solution for building my app on AzureDevOps.
Here's what I've done so far:
p12 certificated uploaded and applied in pipeline following this guide Install Apple Certificate
provisioning certificate uploaded and applied in pipeline Install Apple Provisioning Certificate
Now when I try to build my iOS app using fastlane:
cd ios
bundle install
fastlane beta
setup_ci(force=true)
gym(scheme: 'app', workspace: './ios/workspace', verbose: true)
I'm looking for a way to use the p12 and provisioning profiles certificate from Azure DevOps to my gym build. After looking a lot, I found that setup_ci does that automatically for me.
Here is my Fastlane file
platform :ios do
lane :beta do
setup_ci(force=true)
gym(
scheme: 'AlfaCarpeting', workspace: './ios/AlfaCarpeting', verbose: true
)
end
end
And here's my Azure pipeline yml file:
# Node.js with React
# Build a Node.js project that uses React.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- master
pool:
vmImage: 'macOS-10.15'
variables:
- group: React Native Variables
steps:
- task: InstallAppleCertificate#2
inputs:
certSecureFile: Certificates.p12
certPwd: $(P12Password)
keychain: 'temp'
deleteCert: true
displayName: Install Apple Certificate
- task: InstallAppleProvisioningProfile#1
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: 'alfaCarpetingBeta.mobileprovision'
displayName: 'Install Apple Provisioning Profile'
- task: NodeTool#0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- script: |
cd ios
bundle install
fastlane ios beta
displayName: 'Build iOS'
The Logs from AzureDevops
[05:38:20]: $ set -o pipefail && xcodebuild -workspace ./AlfaCarpeting.xcworkspace -scheme AlfaCarpeting -destination 'generic/platform=iOS' -archivePath /Users/runner/Library/Developer/Xcode/Archives/2020-03-21/AlfaCarpeting\ 2020-03-21\ 05.38.20.xcarchive archive | tee /Users/runner/Library/Logs/gym/AlfaCarpeting-AlfaCarpeting.log | xcpretty
[05:38:22]: ▸ ❌ error: /Users/runner/runners/2.165.2/work/1/s/ios/Pods/Target Support Files/Pods-AlfaCarpeting/Pods-AlfaCarpeting.release.xcconfig: unable to open file (in target "AlfaCarpeting" in project "AlfaCarpeting") (in target 'AlfaCarpeting' from project 'AlfaCarpeting')
[05:38:22]: ▸ ❌ error: /Users/runner/runners/2.165.2/work/1/s/ios/Pods/Target Support Files/Pods-AlfaCarpeting/Pods-AlfaCarpeting.release.xcconfig: unable to open file (in target "AlfaCarpeting" in project "AlfaCarpeting") (in target 'AlfaCarpeting' from project 'AlfaCarpeting')
[05:38:22]: ▸ ❌ error: /Users/runner/runners/2.165.2/work/1/s/ios/Pods/Target Support Files/Pods-AlfaCarpeting/Pods-AlfaCarpeting.release.xcconfig: unable to open file (in target "AlfaCarpeting" in project "AlfaCarpeting") (in target 'AlfaCarpeting' from project 'AlfaCarpeting')
[05:38:22]: ▸ ❌ error: No profiles for 'com.AlfaCarpeting' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.AlfaCarpeting'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'AlfaCarpeting' from project 'AlfaCarpeting')
[05:38:22]: ▸ ** ARCHIVE FAILED **
If you open the project in xcode and goto Build Settings -> Signing you'll want to adjust the "Code Signing Style" to Manual. Here's the settings I ended up with (note - I am using fastlane match for cert and profile management):
Related
We are facing issues with React-Native in AppCenter. We are Once I run the build, everything goes well but at end we are facing below issue.
No addition pre or post script added in AppCenter.
Execution optimizations have been disabled for 12 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
**BUILD SUCCESSFUL** in 11m 32s
362 actionable tasks: 351 executed, 11 up-to-date
##[section]Finishing: Gradle Task
##[section]Starting: Android Postprocess
==============================================================================
Task : Shell script
Description : Run a shell script using Bash
Version : 2.212.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/shell-script
==============================================================================
[command]/bin/bash /Users/runner/runners/2.214.1/scripts/android-postprocess.sh /Users/runner/work/1/s/android/app/build/outputs/apk
Removing all ABI or density dependent APKs…
Found 0 APK file(s)
Found 0 unaligned APK file(s)
~/work/1/s/android/app/build/outputs ~/runners/2.214.1/scripts
~/runners/2.214.1/scripts
##[section]Async Command Start: Add Build Tag
Build '16' has following tags now: normal, android-app-bundle, javascript, android, manual, signed, mapping, distribution
##[section]Async Command End: Add Build Tag
##[section]Finishing: Android Postprocess
##[section]Starting: Sign APK
==============================================================================
Task : Android signing
Description : Sign and align Android APK files
Version : 3.201.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/android-signing
==============================================================================
##****[error]Error: No matching files were found with search pattern: ****/Users/runner/work/1/s/android/app/build/**/*.apk
##[section]Finishing: Sign APK
##[section]Starting: Sign APK
==============================================================================
Task : Android signing
Description : Sign and align Android APK files
Version : 3.201.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/android-signing
==============================================================================
##[section]Finishing: Sign APK
##[section]Starting: Checkout XXXXXXX#development to s
==============================================================================
Task : Get sources
Description : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version : 1.0.0
Author : Microsoft
Help : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Cleaning any cached credential from repository: XXXXXXX (ExternalGit)
##[section]Finishing: Checkout XXXXXXX#development to s
##[section]Starting: Finalize Job
Cleaning up task key
Start cleaning up orphan processes.
Terminate orphan process: pid (23181) (java)
Terminate orphan process: pid (22867) (java)
Terminate orphan process: pid (11113) (java)
Terminate orphan process: pid (7987) (java)
##[section]Finishing: Finalize Job
##[section]Finishing: Build
I tried with all the options but unable to resolve the issues.
I got the answer of my own question. As per Appcenter document you need to set universalApk to true. This is the only way in Appcenter weather you plan to make multiple apk to reduce the size.
I trying to integrate my Solution based on .net6 with SonarCloud and Github actions.The problem is that the action build failed on the sonar scanner end.I tried to change working dirs but with the same effect.The project is public HERE
The SonarScanner for MSBuild integration failed: SonarCloud was unable to collect the required information about your projects.
Possible causes:
The project has not been built - the project must be built in between the begin and end steps
An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0.25420.1 and higher are supported.
The begin, build and end steps have not all been launched from the same folder
None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln) SonarScanner for MSBuild 5.7.2 Using
the .NET Core version of the Scanner for MSBuild Post-processing
started. 10:38:06.016 Generation of the sonar-properties file failed.
Unable to complete the analysis. 10:38:06.024 Post-processing failed.
Exit code: 1 Error: Process completed with exit code 1.
name: build-all
# Controls when the action will run.
on:
push:
branches:
- main
env:
DOTNET_VERSION: 6.0.x
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build-windows:
# The type of runner that the job will run on
runs-on: windows-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout#v2
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- uses: actions/setup-dotnet#v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- uses: microsoft/setup-msbuild#v1
- uses: actions/setup-java#v2
with:
distribution: 'adopt'
java-version: '11'
- name: Restore NuGet packages
run: |
cd App
nuget restore App.sln
- name: Begin Sonar scan
run: |
cd App
dotnet tool install --global dotnet-sonarscanner
dotnet sonarscanner begin /o:vladimirpetukhov /k:vladimirpetukhov_Musement_CLI /d:sonar.login=${{ secrets.SONAR_TOKEN }} /d:sonar.host.url=https://sonarcloud.io
- name: Build Api
run: |
cd ./App/App.API
dotnet build App.API.csproj --no-restore
# dotnet test App.API.csproj --no-build --no-restore --verbosity normal -p:CollectCoverage=true -p:CoverletOutputFormat=opencover
- name: Build Main
run: |
cd ./App/App.Main
dotnet build App.Main.csproj --no-restore
# dotnet test App.Main.csproj --no-build --no-restore --verbosity normal -p:CollectCoverage=true -p:CoverletOutputFormat=opencover
- name: End Sonar scan
run: |
cd App
dotnet sonarscanner end /d:sonar.login=${{ secrets.SONAR_TOKEN }}
I need help to setup my azure-pipelines.yml build file because I cannot find any good tutorial, sample or other kind of help anywhere.
I follow this tutorial by Microsoft https://learn.microsoft.com/en-us/azure/devops/pipelines/languages/dotnet-core?view=azure-devops but despite all information they give I still get errors.
azure-pipelines.yml
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
pool:
vmImage: 'Ubuntu-16.04'
variables:
buildConfiguration: 'Release'
steps:
# - script: dotnet build --configuration $(buildConfiguration)
# displayName: 'dotnet build $(buildConfiguration)'
- task: DotNetCoreInstaller#0
inputs:
version: '2.2.202' # replace this value with the version that you need for your project
- script: dotnet restore
- task: DotNetCoreCLI#2
displayName: Build
inputs:
command: build
projects: '**/*.csproj'
arguments: '--configuration Release' # Update this to match your need
# do this after you've built your app, near the end of your pipeline in most cases
# for example, you do this before you deploy to an Azure web app on Windows
- task: DotNetCoreCLI#2
inputs:
command: publish
publishWebProjects: True
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: True
- task: PublishBuildArtifacts#1
inputs:
ArtifactName: 'drop'
Log
##[section]Starting: DotNetCoreCLI
==============================================================================
Task : .NET Core
Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command. For package commands, supports NuGet.org and authenticated feeds like Package Management and MyGet.
Version : 2.150.1
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?linkid=832194)
==============================================================================
##[error]No web project was found in the repository. Web projects are identified by presence of either a web.config file or wwwroot folder in the directory.
##[error]Project file(s) matching the specified pattern were not found.
##[section]Finishing: DotNetCoreCLI
Why these error and what am I doing wrong?
Additional information
- I can build and publish from Visual Studio to my Azure web app. My API is working. I just cannot do it as part of CI / CD.
- I don't understand this error because I don't understand why the DotNetCore are requesting a web.config.
It only worked for me when I gave it the path to my Web API (set **/*WebApi.csproj to your own location).
But just as importantly, I had to assure the build agent it was NOT a web project by setting publishWebProjects to false.
- task: DotNetCoreCLI#2
displayName: '📗📗📗 Publish 📗📗📗'
inputs:
command: publish
projects: '**/*WebApi.csproj'
publishWebProjects: False
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: True
Q: Are emojis necessary in the publish definition?
A: Yes, emojis are necessary. (Actually, no. But it would be less silly than having to set publishWebProjects to false.)
[command]/usr/bin/xcodebuild -sdk iphoneos -configuration Release -workspace /Users/vsts/agent/2.148.2/work/1/s/ios/community_app.xcworkspace -scheme community_app -allowProvisioningUpdates clean build CODE_SIGN_STYLE=Manual CODE_SIGN_IDENTITY=world unknown PROVISIONING_PROFILE=cad7fbfe-78e7-48a4-a2aa-24fd2337df34 PROVISIONING_PROFILE_SPECIFIER= | /usr/local/lib/ruby/gems/2.6.0/bin/xcpretty -r junit --no-color
▸ Clean Succeeded
❌ error: No certificate for team 'TJPFHY739U' matching 'world unknown' found: Select a different signing certificate for CODE_SIGN_IDENTITY, a team that matches your selected certificate, or switch to automatic provisioning. (in target 'community_app')
❌ error: Provisioning profile "P1" belongs to team "Enterprise Solutions, Inc.", which does not match the selected team "TJPFHY739U". (in target 'community_app')
❌ error: community_appTests does not support provisioning profiles. community_appTests does not support provisioning profiles, but provisioning profile P1 has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'community_appTests')
The branch was previously functional, then merged to master and the builds on master failed. Master was reverted, then master was merged into this branch and some fixes were made. When attempting to merge back to master, the build failed again with the following error. The push passed, the pr failed.
* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find com.squareup.leakcanary:leakcanary-android:1.5.4.
The travis.yml file:
sudo: false
language: android
android:
components:
- build-tools-27.0.2
- android-27
- sys-img-armeabi-v7a-android-27
jdk:
- oraclejdk8
before_install:
- yes | sdkmanager "platforms;android-27"
- chmod +x gradlew
#First app is built then unit tests are run
jobs:
include:
- stage: build
async: true
script: ./gradlew assemble
- stage: test
async: true
script: ./gradlew -w runUnitTests
notifications:
email:
recipients:
- email#me.com
on_success: always # default: change
on_failure: always # default: always
I felt maven repo outage today and faced the same issue. Hours later, I found that the failed Travis Job is working fine now. Do check it at your side.
Also, For any given scenario when classpath dependencies are missing one should check the build.gradle file rather than the .travis.yml file.
The failure message says that the app:debugCompileClasspath task is failing when looking for the com.squareup.leakcanary:leakcanary-android:1.5.4 (jar or AAR). Gradle allows you to define the repositories at the the root level
allProjects{
repositories {
maven() //Gradle has definition the points to https://jcenter.bintray.com/
}
}
So it will look into the following places for the class files or jar file.
Name: $ANDROID_HOME/extras/m2repository; url: file:/$ANDROID_HOME/extras/m2repository/
Name: $ANDROID_HOME/extras/google/m2repository; url: $ANDROID_HOME/extras/google/m2repository/
Name: $ANDROID_HOME/extras/android/m2repository; url: file:$ANDROID_HOME/extras/android/m2repository/
Name: BintrayJCenter; url: https://jcenter.bintray.com/
If not found the dependency resolution will fail giving the error mentioned above.