Running Power Apps CLI to deploy solutions using GitLab CI from Google Cloud Build Triggers

:hugs: Please help fill in this template with all the details to help others help you more efficiently. Use formatting blocks for code, config, logs and ensure to remove sensitive data.

Problem to solve

Describe your question in as much detail as possible:

  • What are you seeing, and how does that differ from what you expect to see?
  • Able to invoke GitLab CI from Google Cloud Build, but unable to call PAC CLI commands in Cloud build as it says path not found.
  • Consider including screenshots, error messages, and/or other helpful visuals

Steps to reproduce

Which troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?

Configuration

Add the CI/CD configuration from .gitlab-ci.yml and other configuration if relevant (e.g. docker-compose.yml). Alternatively, create a public GitLab.com example project that provides all necessary files to reproduce the question.

steps:
  - id: "export_managed"
    name: "mcr.microsoft.com/dotnet/sdk:9.0"
    entrypoint: "bash"
    args:
      - "-c"
      - |
        echo "=== 🏁 Starting Export Process ==="

        # ✅ Define solution name from substitution variable
        SOLUTION_NAME="${_SOLUTION_NAME}"

        # ✅ Install PAC CLI
        dotnet tool install --global Microsoft.PowerApps.CLI.Tool

        export PATH="$_PATH:/root/.dotnet/tools"

        echo "=== 🔍 Checking PAC Installation ==="
        which pac || { echo "❌ PAC not found in PATH!"; exit 1; }
        pac --version

        echo "=== 🔐 Authenticating to Power Platform Environment ==="
        pac auth create \
          -n "GitLabCI" \
          --environment "${_SOURCE_ENV_URL}" \
          --tenant "${_TENANT_ID}" \
          --applicationId "${_CLIENT_ID}" \
          --clientSecret "${_CLIENT_SECRET}" \
          --accept-cleartext-caching

        echo "Listing the Auth profiles"
        pac auth list

        echo "=== 🔄 Selecting Auth Profile ==="
        pac auth select -n "GitLabCI"

        echo "=== 📁 Preparing Output Folder ==="
        mkdir -p solutions/managed

        EXPORT_PATH="solutions/managed/${_SOLUTION_NAME}.zip"

        echo "=== 📦 Exporting Managed Solution: ${_SOLUTION_NAME} ==="
        pac solution export \
          --name "${_SOLUTION_NAME}" \
          --path "${_EXPORT_PATH}" \
          --managed true

        echo "=== 🧩 Copying to Latest Version ==="
        cp "${_EXPORT_PATH}" "solutions/managed/${_SOLUTION_NAME}_latest.zip"

        echo "=== 📂 Listing Managed Folder ==="
        ls -la solutions/managed/

options:
  logging: CLOUD_LOGGING_ONLY

substitutions:
  _SOLUTION_NAME: "B2B ETS Process"
  _SOURCE_ENV_URL: "https://org.crm.dynamics.com"
  _TENANT_ID: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
  _CLIENT_ID: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
  _CLIENT_SECRET: "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Trigged the GitLab CI from Google Cloud Pipeline

Versions: Self Managed

Please select whether options apply, and add the version information.

  • Self-managed
  • GitLab.com SaaS
  • Dedicated
  • Self-hosted Runners

Versions

  • GitLab (Web: /help or self-managed system information sudo gitlab-rake gitlab:env:info):
  • GitLab Runner, if self-hosted (Web /admin/runners or CLI gitlab-runner --version):

Helpful resources

  1. Check the FAQ for helpful documentation, issues/bugs/feature proposals, and troubleshooting tips.
  2. Before opening a new topic, make sure to search for keywords in the forum search
  3. Check the GitLab and GitLab Runner projects for existing issues. If you encounter a bug, please create a bug report issue.
  4. Review existing troubleshooting docs.

Thanks for taking the time to be thorough in your request, it really helps! :blush: