Gzip file in Azure DevOps

Afnan Ashraf

I need to compress a Js file in Azure DevOps in gz format. I have use Azure built-in archive task to zip the file but there is only tar.gz available. I want only gz. Command which i need to run is

7z.exe a -tgzip $targetFile $sourceFile

Is there any way to do this in Azure DevOps.

Matt

7zip appears to be a tool configured on the hosted pipeline image. You can just create a PowerShell task that wraps the calls you want.

An example YML snippet using the windows-2019 image:

- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: '& 7z.exe a -tgzip $(Build.StagingDirectory) $(Build.SourcesDirectory)\README.md'

Log for the task:

Starting: PowerShell
==============================================================================
Task         : PowerShell
Description  : Run a PowerShell script on Linux, macOS, or Windows
Version      : 2.170.1
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
==============================================================================
Generating script.
========================== Starting Command Output ===========================
"C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\a\_temp\a5e0fcab-474f-4462-9a92-36185caa17a8.ps1'"

7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21

Scanning the drive:
1 file, 985 bytes (1 KiB)

Creating archive: D:\a\1\a.gz

Add new data to archive: 1 file, 985 bytes (1 KiB)


Files read from disk: 1
Archive size: 562 bytes (1 KiB)
Everything is Ok
Finishing: PowerShell

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

.gz (gzip) file analysis

分類Dev

GZIP File corrupted - but why?

分類Dev

gzip with file descriptor

分類Dev

azure devops variable group

分類Dev

Azure Devops - Build Automation

分類Dev

Azure DevOps REST API

分類Dev

azure devops repos url

分類Dev

Pass file content as build argument in azure devops pipeline docker build task

分類Dev

How can I exclude changes to the pipeline yaml file to trigger a build i azure devops?

分類Dev

How to find oldobjectid when Uploading/pushing a file to Azure Devops Repo using Pushes Create Api with Python

分類Dev

Create a gzip file of a predetermined size

分類Dev

Reusing PowerShell Scripts in Azure DevOps

分類Dev

Selenium screenshots in VSTS (Azure DevOps)

分類Dev

Configure Azure DevOps email template

分類Dev

How to install Cobertura in azure Devops?

分類Dev

Azure Devops Board vs Jira

分類Dev

Secret Pipeline Parameter in Azure Devops

分類Dev

Viewing a list of Sprints in Azure DevOps

分類Dev

Azure DevOps unable to deploy to Azure Web App

分類Dev

Azure Devops - Deployng React Application - Error - ENOENT: no such file or directory, symlink '../detect-port-alt/bin/detect-port'

分類Dev

Opening a gzip file in python Apache Beam

分類Dev

gzip on a folder without changing the file extension

分類Dev

Django - HTTPStream of gzip file creaed on the fly

分類Dev

Can I decompress a .gzip file with tar?

分類Dev

compress file using /bin/gzip with particular patterns

分類Dev

How to change branch name in Azure DevOps

分類Dev

Is it possible to Import Azure DevOps Work Items

分類Dev

Azure DevOps Hosted Build Agent MSI

分類Dev

Azure DevOps git policy configurations api broken?

Related 関連記事

ホットタグ

アーカイブ