update cocoapods repo when ensuring the ruby cipd package exists

An example LED run: https://ci.chromium.org/ui/p/flutter/builders/try.shadow/Mac_ios%20platform_views_scroll_perf_ad_banners__timeline_summary/2/infra

Note step 12.1.2, it successfully updates the cocoapods repo on disk.

Bug: https://github.com/flutter/flutter/issues/156474
Change-Id: Ic39f1483955c29c2e9bcaa9f0742ad9314dfa655
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/60340
Reviewed-by: Stuart Morgan <stuartmorgan@google.com>
diff --git a/recipe_modules/flutter_deps/api.py b/recipe_modules/flutter_deps/api.py
index f3d04fa..34f31b3 100644
--- a/recipe_modules/flutter_deps/api.py
+++ b/recipe_modules/flutter_deps/api.py
@@ -718,6 +718,12 @@
       paths = env_prefixes.get('PATH', [])
       paths.insert(0, ruby_path / 'bin')
       env_prefixes['PATH'] = paths
+      pod_binary = ruby_path / 'bin' / 'pod'
+      self.m.step(
+          'update cocoapods repo',
+          [pod_binary, 'repo', 'update'],
+          infra_step=True,
+      )
 
   # pylint: disable=unused-argument
   def ktlint(self, env, env_prefixes, version=None):
diff --git a/recipe_modules/flutter_deps/examples/full.expected/basic.json b/recipe_modules/flutter_deps/examples/full.expected/basic.json
index 67e5711..38c35b9 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/basic.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/basic.json
@@ -839,6 +839,18 @@
     ]
   },
   {
+    "cmd": [
+      "[CACHE]/ruby/bin/pod",
+      "repo",
+      "update"
+    ],
+    "infra_step": true,
+    "name": "Install ruby.update cocoapods repo",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "Install ktlint"
   },
diff --git a/recipe_modules/flutter_deps/examples/full.expected/goldTryjob.json b/recipe_modules/flutter_deps/examples/full.expected/goldTryjob.json
index 67e5711..38c35b9 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/goldTryjob.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/goldTryjob.json
@@ -839,6 +839,18 @@
     ]
   },
   {
+    "cmd": [
+      "[CACHE]/ruby/bin/pod",
+      "repo",
+      "update"
+    ],
+    "infra_step": true,
+    "name": "Install ruby.update cocoapods repo",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "Install ktlint"
   },
diff --git a/recipe_modules/flutter_deps/examples/full.expected/linux.json b/recipe_modules/flutter_deps/examples/full.expected/linux.json
index 67e5711..38c35b9 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/linux.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/linux.json
@@ -839,6 +839,18 @@
     ]
   },
   {
+    "cmd": [
+      "[CACHE]/ruby/bin/pod",
+      "repo",
+      "update"
+    ],
+    "infra_step": true,
+    "name": "Install ruby.update cocoapods repo",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "Install ktlint"
   },
diff --git a/recipe_modules/flutter_deps/examples/full.expected/local_engine_cas.json b/recipe_modules/flutter_deps/examples/full.expected/local_engine_cas.json
index 17029f1..7e54426 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/local_engine_cas.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/local_engine_cas.json
@@ -923,6 +923,18 @@
     ]
   },
   {
+    "cmd": [
+      "[CACHE]/ruby/bin/pod",
+      "repo",
+      "update"
+    ],
+    "infra_step": true,
+    "name": "Install ruby.update cocoapods repo",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "Install ktlint"
   },
diff --git a/recipe_modules/flutter_deps/examples/full.expected/local_web_sdk_cas.json b/recipe_modules/flutter_deps/examples/full.expected/local_web_sdk_cas.json
index 6e5fda4..037b415 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/local_web_sdk_cas.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/local_web_sdk_cas.json
@@ -923,6 +923,18 @@
     ]
   },
   {
+    "cmd": [
+      "[CACHE]/ruby/bin/pod",
+      "repo",
+      "update"
+    ],
+    "infra_step": true,
+    "name": "Install ruby.update cocoapods repo",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "Install ktlint"
   },
diff --git a/recipe_modules/flutter_deps/examples/full.expected/mac.json b/recipe_modules/flutter_deps/examples/full.expected/mac.json
index 826aca3..53f8e98 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/mac.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/mac.json
@@ -861,6 +861,18 @@
     ]
   },
   {
+    "cmd": [
+      "[CACHE]/ruby/bin/pod",
+      "repo",
+      "update"
+    ],
+    "infra_step": true,
+    "name": "Install ruby.update cocoapods repo",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "Install ktlint"
   },
diff --git a/recipe_modules/flutter_deps/examples/full.expected/mac_old.json b/recipe_modules/flutter_deps/examples/full.expected/mac_old.json
index 136389c..db31127 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/mac_old.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/mac_old.json
@@ -861,6 +861,18 @@
     ]
   },
   {
+    "cmd": [
+      "[CACHE]/ruby/bin/pod",
+      "repo",
+      "update"
+    ],
+    "infra_step": true,
+    "name": "Install ruby.update cocoapods repo",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "Install ktlint"
   },
diff --git a/recipe_modules/flutter_deps/examples/full.expected/noop_golds_official_builds.json b/recipe_modules/flutter_deps/examples/full.expected/noop_golds_official_builds.json
index c823788..ed72aba 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/noop_golds_official_builds.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/noop_golds_official_builds.json
@@ -1190,6 +1190,30 @@
     ]
   },
   {
+    "cmd": [
+      "[CACHE]/ruby/bin/pod",
+      "repo",
+      "update"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart-internal:flutter"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "Install ruby.update cocoapods repo",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "Install ktlint"
   },
diff --git a/recipe_modules/flutter_deps/examples/full.expected/windows_vs_installed.json b/recipe_modules/flutter_deps/examples/full.expected/windows_vs_installed.json
index c4c586f..a212d7f 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/windows_vs_installed.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/windows_vs_installed.json
@@ -943,6 +943,18 @@
     ]
   },
   {
+    "cmd": [
+      "[CACHE]\\ruby\\bin\\pod",
+      "repo",
+      "update"
+    ],
+    "infra_step": true,
+    "name": "Install ruby.update cocoapods repo",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "Install ktlint"
   },
diff --git a/recipe_modules/flutter_deps/examples/full.expected/windows_vs_not_installed.json b/recipe_modules/flutter_deps/examples/full.expected/windows_vs_not_installed.json
index 585d74d..6f9828f 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/windows_vs_not_installed.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/windows_vs_not_installed.json
@@ -1445,6 +1445,18 @@
     ]
   },
   {
+    "cmd": [
+      "[CACHE]\\ruby\\bin\\pod",
+      "repo",
+      "update"
+    ],
+    "infra_step": true,
+    "name": "Install ruby.update cocoapods repo",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "Install ktlint"
   },