首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Azure DevOps中的Gzip文件

Azure DevOps中的Gzip文件
EN

Stack Overflow用户
提问于 2020-09-17 17:20:18
回答 1查看 776关注 0票数 1

我需要将Js文件压缩为Azure DevOps格式的gz格式。我已经使用Azure内置存档任务来zip文件,但是只有tar.gz可用。我只想要gz。命令,需要运行的命令是

代码语言:javascript
复制
7z.exe a -tgzip $targetFile $sourceFile

有没有办法在Azure DevOps中做到这一点。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-09-17 17:29:22

7zip似乎是在托管管道映像上配置的一个工具。您只需创建一个包装所需调用的PowerShell任务即可。

使用windows-2019映像的示例YML片段:

代码语言:javascript
复制
- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: '& 7z.exe a -tgzip $(Build.StagingDirectory) $(Build.SourcesDirectory)\README.md'

记录任务的日志:

代码语言:javascript
复制
Starting: PowerShell
==============================================================================
Task         : PowerShell
Description  : Run a PowerShell script on Linux, macOS, or Windows
Version      : 2.170.1
Author       : Microsoft Corporation
Help         : https://learn.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
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63943184

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档