Fastlane:如何将lane_context传递到另一个车道

我使用Jenkins管道构建应用程序。在管道中,我两次调用快速通道,在两次通道之间调用集成测试。

这是iOS脚本

default_platform(:ios)

before_all do |lane,options|
  IPA_NAME = options[:ipa_name];
  ENV["SLACK_URL"] = "slack_url";
  ENV["DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS"] = "-t DAV"
end

platform :ios do
  lane :build_to_browserstack do |lane,options|
    begin
      build_app()
      push_to_browserstack()
    rescue => exception
      error_do_all_operations(exception)
    end
  end
end

platform :ios do
  lane :push_to_testflight do |lane,options|
    begin
      push_to_testflight_and_s3()
      passed_do_all_operations()
    rescue => exception
      error_do_all_operations(exception)
    end
  end
end

def build_app
  clean_build_artifacts
  cert
  sigh(
    skip_install: true,provisioning_name: 'name'
  )
  increment_version_number(
    version_number: "1.22.3"
  )
  increment_build_number({
    build_number: latest_testflight_build_number + 1
  })
  get_version_number(
    target: ENV["SCHEME"]
  )
  get_build_number
  gym(
    scheme: ENV["SCHEME"],export_options: {
      provisioningProfiles: {
        "com.com.com" => "profile"
      }
    },output_name: IPA_NAME
  )
end

def push_to_browserstack
  upload_to_browserstack_app_automate(
    browserstack_username: "name",browserstack_access_key: "key",file_path: ENV["PATH_TO_IPA"] + IPA_NAME,custom_id: IPA_NAME
  )
end

def push_to_testflight_and_s3
  upload_to_testflight(
     ipa: ENV["PATH_TO_IPA"] + IPA_NAME,skip_submission: true,skip_waiting_for_build_processing: true,team_name: 'team'
  )
  aws_s3(
    access_key: 'key',secret_access_key: 'key',bucket: 'bucket',region: 'us-east-2',ipa: ENV["PATH_TO_IPA"] + IPA_NAME,path: 'path'
  )
end

def passed_do_all_operations
  slack(
    message: "New iOS build was uploaded to TestFlight",success: true,channel: "#engineering_general",slack_url: ENV["SLACK_URL"],default_payloads: [:git_branch],payload: {"Build Date" => Time.new.to_s,},attachment_properties: {
      fields: [
        {
          title: "Version number",value: lane_context[SharedValues::VERSION_NUMber],{
          title: "Build number",value: lane_context[SharedValues::BUILD_NUMber],}
      ]
    }
  )
end

def error_do_all_operations(exception)
  slack(
    message: "iOS build was not uploaded to TestFlight",success: false,attachment_properties: {
      fields: [
      {
        title: "Version number",{
        title: "Build number",{
        title: "Error message",value: exception.to_s,short: false
      }
      ]
    }
  )
end

我使用Fastlane的参数化调用,代码安全:

before_all do |lane,options|
  IPA_NAME = options[:ipa_name];

首先,我调用通道build_to_browserstack。现在由于我的browserstack accout而出现错误,并且error_do_all_operations()函数正确生成了松弛通知,其值为lane_context[SharedValues::VERSION_NUMber],lane_context[SharedValues::BUILD_NUMber],

接下来,我调用通道push_to_testflight,这是一个问题。函数passed_do_all_operations()产生不带lane_context值的松弛通知。

所以问题是如何将Lane_context从第一次调用传递到第二次调用?

wu379611988 回答:Fastlane:如何将lane_context传递到另一个车道

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3118078.html

大家都在问