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

Updating actions-install to permit overriding the nuget feed #441

Merged
merged 2 commits into from
Sep 15, 2023

Conversation

tehcrashxor
Copy link
Member

@tehcrashxor tehcrashxor commented Sep 9, 2023

AB#3582314

Current State

Today without any changes, users can us the v1 version of the package to install PAC from nuget packages stored in their own private feeds. Local folders also count as valid feed sources, so users could get copies of the Microsoft.PowerApps.CL (net48, Windows only) or Microsoft.PowerApps.CLI.Tool (net6.0, cross-plat but only used for Linux/macOS currently) packages through their companies approval process, and added either to internal feeds or as artifacts directly downloaded onto their build agent / actiosn runner.

Examples:

jobs:
  Config-before-our-actions-authenticated-feed:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [windows-latest, ubuntu-latest]
      fail-fast: false 
    steps:
      - run: dotnet nuget add source https://pkgs.dev.azure.com/REDACTED/nuget/v3/index.json -n InternalFeed -u foo -p ${{ secrets.AZ_DevOps_Read_PAT }} --store-password-in-clear-text
      - name: Install PAC
        uses: microsoft/powerplatform-actions/actions-install@v1
        with:
          pac-version-override: 1.27.1-daily-23082819
      - name: Who Am I test
        uses: microsoft/powerplatform-actions/who-am-i@v1
        with:
          environment-url: ${{ env.WF_ENVIRONMENT_URL }}
          user-name: ${{ env.WF_USERNAME }}
          password-secret: ${{ secrets.PASSWORD_PPDEVTOOLS }}

  Config-before-our-actions-local-folder:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [windows-latest, ubuntu-latest]
      fail-fast: false 
    steps:
      - uses: actions/checkout@v4
      - run: dotnet nuget add source ${{ github.workspace }}/localNuget
      - name: Install PAC
        uses: microsoft/powerplatform-actions/actions-install@v1
        with:
          pac-version-override: 1.26.6
      - name: Who Am I test
        uses: microsoft/powerplatform-actions/who-am-i@v1
        with:
          environment-url: ${{ env.WF_ENVIRONMENT_URL }}
          user-name: ${{ env.WF_USERNAME }}
          password-secret: ${{ secrets.PASSWORD_PPDEVTOOLS }}

image


This Change

Using a different feed, including private feed authentication options

These changes add some install options to the actions-install step to allow overriding the nuget feed, without needing to do so in a previous step, and creates the nuget config file without nuget.org present when overridden so that no communication outside is attempted.

New-Feed-Params-authenticated-feed:
  runs-on: ${{ matrix.os }}
  strategy:
    matrix:
      os: [windows-latest, ubuntu-latest]
    fail-fast: false
  steps:
    - name: Install PAC
      uses: microsoft/powerplatform-actions/actions-install@tehcrash-install-improvements
      with:
        pac-version-override: 1.27.1-daily-23082819
        nuget-feed-override: https://pkgs.dev.azure.com/REDACTED/nuget/v3/index.json
        nuget-feed-username: foo  # ADO feeds like this one require a non-empty value for the username, but don't use it 
        nuget-feed-password: ${{ secrets.AZ_DevOps_Read_PAT }} 
    - name: Who Am I test
      uses: microsoft/powerplatform-actions/who-am-i@tehcrash-install-improvements
      with:
        environment-url: ${{ env.WF_ENVIRONMENT_URL }}
        user-name: ${{ env.WF_USERNAME }}
        password-secret: ${{ secrets.PASSWORD_PPDEVTOOLS }}

Using a local folder where the PAC nuget package has already been downloaded to

and like before, a local folder containing already-downloaded nuget packages is likewise valid:

New-Feed-Params-local-package-folder:
  runs-on: ${{ matrix.os }}
  strategy:
    matrix:
      os: [windows-latest, ubuntu-latest]
    fail-fast: false
  steps:
    - uses: actions/checkout@v4
    - name: Install PAC
      uses: microsoft/powerplatform-actions/actions-install@tehcrash-install-improvements
      with:
        pac-version-override: 1.26.6
        nuget-feed-override: ${{ github.workspace }}/localNuget  # The feed here is a local folder where the .nupkg already exists
    - name: Who Am I test
      uses: microsoft/powerplatform-actions/who-am-i@tehcrash-install-improvements
      with:
        environment-url: ${{ env.WF_ENVIRONMENT_URL }}
        user-name: ${{ env.WF_USERNAME }}
        password-secret: ${{ secrets.PASSWORD_PPDEVTOOLS }}

image

Using an already-installed PAC on the actions runner:

actions-install's use-preinstalled-pac parameter allows pointing to an existing copy of pac.exe (windows) or pac (linux/mac)

Use-Preinstalled-Pac:
  runs-on: ubuntu-latest
  steps:
    - name: pre-install PAC before running our powerplatform-actions
      run: dotnet tool install Microsoft.PowerApps.CLI.Tool --version 1.26.6 --tool-path ./
    - name: Tell powerplatform-actions where preinstalled PAC is via actions-install step
      uses: microsoft/powerplatform-actions/actions-install@tehcrash-install-improvements
      with: 
        use-preinstalled-pac: ./pac  # Path to the already-installed PAC executable
    - name: Who Am I test
      uses: microsoft/powerplatform-actions/who-am-i@tehcrash-install-improvements
      with:
        environment-url: ${{ env.WF_ENVIRONMENT_URL }}
        user-name: ${{ env.WF_USERNAME }}
        password-secret: ${{ secrets.PASSWORD_PPDEVTOOLS }}

image

@tehcrashxor tehcrashxor marked this pull request as ready for review September 15, 2023 18:28
@tehcrashxor tehcrashxor merged commit b8bbdcf into main Sep 15, 2023
5 checks passed
@tehcrashxor tehcrashxor deleted the tehcrash-install-improvements branch September 15, 2023 20:13
@tehcrashxor tehcrashxor restored the tehcrash-install-improvements branch September 15, 2023 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants