maikvandergaag / msft-extensions

Repository for extensions mainly used for Azure DevOps Extensions
https://msftplayground.com
MIT License
126 stars 80 forks source link

Problems with dots in pbix file name (*2024.01.22 - my name.pbix*) #523

Open michelmetran opened 5 months ago

michelmetran commented 5 months ago

Describe the issue I am using the extension to upload pbix files.

I noticed that when the file has a dot in the middle of the filename, it gives an error and the upload modifies the name truncating at the first dot.

If the file is named 2024.01.22 - my name.pbix, at the workspace will be 2024.01.



Extension



To Reproduce I maintain my repositories with azure-pipelines.yml file with the following content to perform the steps of creating artifact and publishing

# Pipeline criado para automatizar a publicação de
# arquivos .pbix em workspaces do Power BI
#
# Michel Metran
# Data: 05.10.2023
# Atualizado em: 22.01.2024
# -------------------------

trigger:
  - main

# Agent
pool:
  vmImage: windows-2019

# Parâmetros
parameters:
  - name: BI2Workspace
    type: object
    default:
      - NamePbixFile: '2024.01.22 - ANPPs.pbix'
        WorkspaceName: 'CTIC - old'

# Variáveis
variables:
  # Set Service
  PowerBIService: 'service-principal'

  # Debugar Pipeline
  system.debug: 'true'

steps:
  # Loop
  # https://igeorgiev.eu/devops/azure-pipelines-use-each-loop/
  - ${{ each params in parameters.BI2Workspace }}:

    # Copia o arquivo .pbix para Staging Directory
    - task: CopyFiles@2
      displayName: 'Copy Files to: "$(Build.ArtifactStagingDirectory)"'
      inputs:
        SourceFolder: $(Build.SourcesDirectory)
        Contents: '**/${{ params.NamePbixFile }}'
        TargetFolder: $(Build.ArtifactStagingDirectory)
        flattenFolders: true
        OverWrite: true

    # Publica arquivo do Staging Directory no Artifact
    # https://learn.microsoft.com/pt-br/azure/devops/pipelines/tasks/reference/publish-build-artifacts-v1
    - task: PublishBuildArtifacts@1
      displayName: 'Publish Artifact to: $(Build.ArtifactStagingDirectory)'
      inputs:
        PathtoPublish: $(Build.ArtifactStagingDirectory)
        ArtifactName: my_artifact
        publishLocation: Container
        MaxArtifactSize: 0
        Parallel: false
        StoreAsTar: false

    # Publica Artifact na workspace
    - task: maikvandergaag.maikvandergaag-power-bi-actions.PowerBIActions.PowerBIActions@5
      displayName: 'Power BI: Publish in Workspace'
      inputs:
        PowerBIServiceEndpoint: '${{ variables.PowerBIService }}'
        WorkspaceName: '${{ params.WorkspaceName }}'
        PowerBIPath: '$(System.ArtifactsDirectory)/${{ params.NamePbixFile }}'



Expected behavior

Publish with the correct name.



Situation



Log info log.txt



Additional information

I noticed that if I try to upload with powershell, uploading with pbix does not change the name.

New-PowerBIReport -WorkspaceId 3eb21cbd-bca42 -Path 'C:\Users\user\bi_anpp\bi\versions\2024.01.22 - ANPPs.pbix'
maikvandergaag commented 3 months ago

Marked it as a feature request and added it to the project to be picked up