Is there a way to get fast lane logs to use on orbs

I want to customize the ms teams circle ci integration and will like to get some output from fast lane like build xxx was uploaded to AppCenter example [21:40:08]: Release '152' (4.6.0) was successfully updated from circle ci app


I’ve set the orb to work but not able to get any info from fast lane

There are a lot of ways to achieve this. You could capture fastlane’s output with tee so that you have it in a file, and then grep that file for the line(s) you want to include in your Teams message. Or you could update your fastlane lane to write a message like this to a file — or even, probably, to talk directly to Teams.

What’s the specific problem you’re trying to solve?

I would like to post to teams that specific build is done, like build 255 is uploaded to AppCenter, the idea is to avoid having to look logs and get build number in app center to inform qa tester what app version is available to test, weird because the lates build is not always shown in app center.

OK, so where does that build number come from? Are you generating it in your fastlane code, getting it from appcenter, something else?

is coming from appcenter

So then you should see whether that value is accessible from the fastlane action (in Ruby), or if you’ll need to pull it from the output (using tee/grep as I mentioned earlier). I’m not familiar with fastlane’s appcenter action, but fastlane actions usually have decent documentation.

I saw the documentation on fast lane plugin, also epicenter plugin returns a json with the values I need like the id and app version just need a way to get those values from teams orb
.

Can you share your config? I’m not familiar with the teams orb so I’m not sure where the boundary is between your code/config and the orb.

sorry my bad need a way to grab the values from appcenter with fastlane-plugin-appcenter like this

appcenter_fetch_version_number(
        api_token: ENV["APPCENTER_UPLOAD_API_TOKEN_2023"],
        owner_name: "<appcenter account name of the owner of the app (username or organization URL name)>",
        app_name: "<appcenter app name (as seen in app URL)>",
        version: "a specific version to get the last release for" # optional, don't set this value to get the last upload of all versions
      )

and with this using fast file

teams_card(
    workflow_url: 'https://your.logic.azure.com:443/workflows/1234567890',
    text: 'A new release is ready for testing!',
    image: 'https://raw.githubusercontent.com/fastlane/boarding/master/app/assets/images/fastlane.png',
    image_title: 'Fastlane',
    ]
  )

and include the id or version in the text to be something like text: $id release is ready to test
where id Is the id from this response

{"id"=>1, "version"=>"1.0.0", "build_number"=>"1.0.0.1234"} # iOS apps contain the full version plus build number due to the way that Apple use CFBundleVersion for this value
{"id"=>588, "version"=>"1.2.0", "build_number"=>"1615"}

this are just examples of the documentation need to set real values.

though this is not clear for me quote the plugging documentation
The appcenter_fetch_version_number returns a hash that contains the id, the version number, and the build number. The version corresponds to the short_version and the build number to the version known by App Center for a given release:

I think this approach will be more simple than using the orb that is working at this time but will imply to parse the file looking for the lines needed.
also the orb is set to something like this

jobs:
  build-and-test:
    executor: main-executor
    # Define the steps required to build the project.
    steps:
      # Get the code from the VCS provider.
      - checkout
      - reveal_secret
      - install_gems
      # Run tests.
      - run:
          name: Run tests
          command: bundle exec fastlane test
      - msteams/notify:
          message: Dev build
          webhook: https://xxx.webhook.office.com/webhookb2/xxxxx/IncomingWebhook/xxxx

for build and test and for distribution is set to

steps:
      - checkout
      - reveal_secret
      - install_gems
      - decode_certificates
      - setup_provisioning_profiles
      - run:
          name: Build sign and deploy
          command: bundle exec fastlane Builds
      - msteams/status:
          failure_message: ':red_circle: A $CIRCLE_JOB job has failed!'
          success_message: ':tada: A $CIRCLE_JOB job has succeeded  Build uploaded !'
          webhook: webhookurl

I agree with you, I think using those two fastlane actions is a good plan! Seems like you can pull the build_number from the result of appcenter_fetch_version_number and use it in the text of teams_card.

1 Like

thanks for pointing me in the right direction already finishing the integration with minor cosmetics details. had to learn some ruby for some issues like reading from appcenter_fetch_version with hash[‘paramname’] instead of hash[:paramname]

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.