Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added support for appcenter is_ci? #12512

Merged
merged 4 commits into from May 17, 2018

Conversation

RishabhTayal
Copy link
Contributor

Description

Currently is_ci action doesn't support Microsoft Appcenter CI. This PR adds support for the same.

fixes: #12511

@RishabhTayal
Copy link
Contributor Author

This is ready for review.

@@ -52,6 +52,11 @@
expect(FastlaneCore::Helper.ci?).to be(true)
end

it "returns true when building in AppCenter" do
stub_const('ENV', { 'APPCENTER_OUTPUT_DIRECTORY' => '/Users/vsts/agent/2.133.3/work/1/a/build' })
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's not a good idea to hardcode local paths

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you suggest? The idea here is to check if a value exists for APPCENTER_OUTPUT_DIRECTORY.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, ok, I thought it's actually doing something with the directory at that path. Maybe you could replace it with /path/to/a/build to avoid confusion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@@ -52,6 +52,11 @@
expect(FastlaneCore::Helper.ci?).to be(true)
end

it "returns true when building in AppCenter" do
stub_const('ENV', { 'APPCENTER_OUTPUT_DIRECTORY' => '/path/to/a/build' })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure APPCENTER doesn't set any of the other available ENV variables, especially the CI variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KrauseFx I went through the environment variables on AppCenter and in my opinion looks like APPCENTER_OUTPUT_DIRECTORY would be the best one to check. You can suggest me some other variable. Here is the output of command printenv on AppCenter.

Output
BUILD_SOURCEBRANCH=refs/heads/master
SYSTEM_TEAMFOUNDATIONCOLLECTIONURI=https://msft-sonoma-prod-00a5f2.visualstudio.com/
SYSTEM_TASKDEFINITIONSURI=https://msft-sonoma-prod-00a5f2.visualstudio.com/
AGENT_VERSION=2.133.3
BUILD_QUEUEDBY=***-00a5ef@projectsonomaprod.onmicrosoft.com
SYSTEM_HOSTTYPE=build
BUILD_REPOSITORY_GIT_SUBMODULECHECKOUT=True
ANDROID_HOME=/Users/vsts/Library/Android/sdk
MD_APPLE_SDK_ROOT=/Applications/Xcode.app
SHELL=/bin/bash
BUILD_STAGINGDIRECTORY=/Users/vsts/agent/2.133.3/work/1/a
MOBILECENTER_SOURCE_DIRECTORY=/Users/vsts/agent/2.133.3/work/1/s
AGENT_MACHINENAME=Mac-24
TMPDIR=/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/
APPCENTER_BRANCH=master
COMMON_TESTRESULTSDIRECTORY=/Users/vsts/agent/2.133.3/work/1/TestResults
SYSTEM_WORKFOLDER=/Users/vsts/agent/2.133.3/work
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.b0XLBJlVDl/Render
APPCENTER_XCODE_PROJECT=Project.xcworkspace
AGENT_JOBNAME=Job
MSDEPLOY_HTTP_USER_AGENT=VSTS_499a90ab-c286-44de-88b6-4eee9b49382e_build_1_185
RCT_NO_LAUNCH_PACKAGER=1
JAVA_HOME_8_X64=/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home
XCODE_9_DEVELOPER_DIR=/Applications/Xcode_9.3.app/Contents/Developer
MOBILECENTER_XCODE_PROJECT=Project.xcworkspace
BUILD_REQUESTEDFOREMAIL=***-00a5ef@projectsonomaprod.onmicrosoft.com
NUNIT_BASE_PATH=/Library/Developer/nunit
LC_ALL=en_US.UTF-8
NUNIT3_PATH=/Library/Developer/nunit/3.6.0
SYSTEM_CULTURE=en-US
INPUT_ARGS=
BUILD_REPOSITORY_CLEAN=true
BUILD_REPOSITORY_PROVIDER=Git
AGENT_TEMPDIRECTORY=/Users/vsts/agent/2.133.3/work/_temp
BUILD_SOURCEBRANCHNAME=master
USER=vsts
SYSTEM_TEAMFOUNDATIONSERVERURI=https://msft-sonoma-prod-00a5f2.visualstudio.com/
TF_BUILD=True
AZURE_HTTP_USER_AGENT=VSTS_499a90ab-c286-44de-88b6-4eee9b49382e_build_1_185
BUILD_QUEUEDBYID=bc606afa-b55b-6268-b8fa-b0295380c3a3
APPCENTER_OUTPUT_DIRECTORY=/Users/vsts/agent/2.133.3/work/1/a/build
APPCENTER_XCODE_SCHEME=Project
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.fMludoP04H/Listeners
VSTS_PROCESS_LOOKUP_ID=vsts_923993cf-d89b-4e86-9563-f27373bcafa8
BUILDSCRIPTS_TOOLSET={"Project.xcodeproj":{"postBuild":"appcenter-post-build.sh","postClone":"appcenter-post-clone.sh","preBuild":"appcenter-pre-build.sh"},"Project.xcworkspace":{"postBuild":"appcenter-post-build.sh","postClone":"appcenter-post-clone.sh","preBuild":"appcenter-pre-build.sh"}}
SYSTEM_TEAMPROJECTID=218c4337-31d2-4dab-ac8a-d47148ff3d77
AGENT_ROOTDIRECTORY=/Users/vsts/agent/2.133.3/work
__CF_USER_TEXT_ENCODING=0x1F5:0:0
AGENT_HOMEDIRECTORY=/Users/vsts/agent/2.133.3
SYSTEM_TEAMPROJECT=Sonoma
AGENT_TOOLSDIRECTORY=/Users/vsts/agent/2.133.3/work/_tool
MOBILECENTER_BUILD_ID=185
BUILD_REPOSITORY_ID=https://github.com/username/repo.git
BUILD_REPOSITORY_LOCALPATH=/Users/vsts/agent/2.133.3/work/1/s
SYSTEM_JOBDISPLAYNAME=Job
agent.jobstatus=Succeeded
BUILD_REASON=Manual
SYSTEM=build
AGENT_BUILDDIRECTORY=/Users/vsts/agent/2.133.3/work/1
SDK=iphoneos
BUILD_SOURCESDIRECTORY=/Users/vsts/agent/2.133.3/work/1/s
AGENT_OS=Darwin
PATH=/Library/Frameworks/Mono.framework/Versions/4/bin:/usr/local/bin:/usr/local/sbin:/Users/vsts/bin:/Users/vsts/.yarn/bin:/usr/local/go/bin:/Users/vsts/Library/Android/sdk/tools:/Users/vsts/Library/Android/sdk/platform-tools:/Users/vsts/Library/Android/sdk/ndk-bundle:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/bin:/bin:/usr/sbin:/sbin:/Users/vsts/.azcopy
SYSTEM_DEBUG=false
SYSTEM_ISSCHEDULED=False
MOBILECENTER_OUTPUT_DIRECTORY=/Users/vsts/agent/2.133.3/work/1/a/build
MOBILECENTER_XCODE_SCHEME=Project
_=/usr/bin/printenv
MOBILECENTER_BRANCH=master
BUILD_BUILDURI=vstfs:///Build/Build/185
SYSTEM_PULLREQUEST_ISFORK=False
PWD=/Users/vsts/agent/2.133.3/work/1/s
SYSTEM_DEFINITIONID=1
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home
JAVA_HOME_7_X64=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home
MOBILECENTER_TRIGGER=manual
LANG=en_US.UTF-8
APPCENTER_BUILD_ID=185
SYSTEM_PHASEDISPLAYNAME=Build
SYSTEM_SERVERTYPE=Hosted
BUILD_REPOSITORY_NAME=Project
XPC_FLAGS=0x0
TESTSDK=iphonesimulator
BUILD_REPOSITORY_URI=https://github.com/username/repo.git
AGENT_WORKFOLDER=/Users/vsts/agent/2.133.3/work
BUILD_DEFINITIONNAME=master_default
JAVA_HOME_9_X64=/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home
BUILD_REQUESTEDFOR=***-00a5ef@projectsonomaprod.onmicrosoft.com
SYSTEM_JOBNAME=__default
XPC_SERVICE_NAME=0
SYSTEM_ARTIFACTSDIRECTORY=/Users/vsts/agent/2.133.3/work/1/a
SYSTEM_TIMELINEID=25b88374-add0-4757-a4d4-1ebd1af8a14c
AGENT_ID=5
JAVA_HOME_10_X64=/Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home
XCODE_8_DEVELOPER_DIR=/Applications/Xcode_8.3.3.app/Contents/Developer
HOME=/Users/vsts
SHLVL=2
APPCENTER_TRIGGER=manual
BUILD_ARTIFACTSTAGINGDIRECTORY=/Users/vsts/agent/2.133.3/work/1/a
BUILD_REQUESTEDFORID=bc606afa-b55b-6268-b8fa-b0295380c3a3
BUILD_BINARIESDIRECTORY=/Users/vsts/agent/2.133.3/work/1/b
BUILD_BUILDID=185
SONOMA_TAGS=xcode,manual
LOGNAME=vsts
BUILD_SOURCEVERSION=e149e3b5bc6236f7ef9df01a6cd5720c721058a9
LC_CTYPE=en_US.UTF-8
PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Versions/4/lib/pkgconfig:/Library/Frameworks/Mono.framework/Versions/4/share/pkgconfig:
SYSTEM_DEFAULTWORKINGDIRECTORY=/Users/vsts/agent/2.133.3/work/1/s
SYSTEM_JOBID=ff7265dc-abe3-5e6a-6194-76bb88f00044
ANDROID_NDK_HOME=/Users/vsts/Library/Android/sdk/ndk-bundle
AGENT_NAME=Hosted Agent
SYSTEM_PLANID=25b88374-add0-4757-a4d4-1ebd1af8a14c
SYSTEM_PHASEID=49716776-8a63-59f5-ea65-2d6f4094a180
BUILD_DEFINITIONVERSION=14
SYSTEM_COLLECTIONID=499a90ab-c286-44de-88b6-4eee9b49382e
AGENT_JOBSTATUS=Succeeded
TASK_DISPLAYNAME=Post Clone Script
ENDPOINT_URL_SYSTEMVSSCONNECTION=https://msft-sonoma-prod-00a5f2.visualstudio.com/
BUILD_BUILDNUMBER=185
SYSTEM_PHASENAME=Phase_0
APPCENTER_SOURCE_DIRECTORY=/Users/vsts/agent/2.133.3/work/1/s
BUILD_CONTAINERID=546134

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is weird that they don't set CI 😖

Copy link
Member

@joshdholtz joshdholtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is using APPCENTER_OUTPUT_DIRECTORY okay? Or would it be better to use something like APPCENTER_BUILD_ID ? 🤔 I don't know much about AppCenter 🙃

@RishabhTayal
Copy link
Contributor Author

@joshdholtz I am not sure which one to use. Both of the vars seems like reasonable choice. APPCENTER_BUILD_ID is also fine. I am assuming all the builds triggered on AppCenter would have both the variables. We can just pick one for now and change later is the picked one causes some issue. What do you say?

@joshdholtz
Copy link
Member

@RishabhTayal I personally like APPCENTER_BUILD_ID but I don't have any good reason why 😊

@RishabhTayal
Copy link
Contributor Author

No problem. Will change it build id.

@RishabhTayal
Copy link
Contributor Author

@joshdholtz Changed it to APPCENTER_BUILD_ID. Ready to review again. 👍

Copy link
Member

@joshdholtz joshdholtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is goooooood 👍

@joshdholtz joshdholtz merged commit 9f6818a into fastlane:master May 17, 2018
@RishabhTayal RishabhTayal deleted the is_ci]-support-app-center branch May 17, 2018 15:05
@fastlane-bot
Copy link

Hey @RishabhTayal 👋

Thank you for your contribution to fastlane and congrats on getting this pull request merged 🎉
The code change now lives in the master branch, however it wasn't released to RubyGems yet.
We usually ship about once a week, and your PR will be included in the next one.

Please let us know if this change requires an immediate release by adding a comment here 👍
We'll notify you once we shipped a new release with your changes 🚀

@fastlane-bot
Copy link

Congratulations! 🎉 This was released as part of fastlane 2.96.0 🚀

@fastlane fastlane locked and limited conversation to collaborators Jul 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[question] - is_ci? is false
6 participants