Azure Devops Ruby在Rails上的释放错误

发布于 2025-01-24 03:31:21 字数 1712 浏览 0 评论 0原文

我是Azure Devops的新手,想在Rails网站上实现一个简单的Ruby。我在网上看到的教程主要集中在.NET中。以下是我创建的azure-pipeline.yml文件。该代码构建无错误的构建,但是当我在Rauds On Rails模板上创建发行版时,会产生错误。 我的错误, rakefile ,我的构建管道输出看起来像这样。任何人都可以帮助我或参考Ruby on Rails的一些Azure Devops教程。

```
# Ruby
# Package your Ruby project.
# Add steps that install rails, analyze code, save build artifacts, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/ruby

trigger:
- main

pool:
  vmImage: ubuntu-latest

steps:
- task: UseRubyVersion@0
  inputs:
    versionSpec: '>= 3.0'
    addToPath: true

- script: |
    CALL gem install bundler
    bundle init
    gem install rake
    bundle install --retry=3 --jobs=4
  displayName: 'bundle install'

- script: bundle exec rake
  displayName: 'bundle exec rake'


- task: PublishCodeCoverageResults@1
  inputs:
    codeCoverageTool: Cobertura
    summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
    reportDirectory: '$(System.DefaultWorkingDirectory)/**/coverage'

- task: PublishBuildArtifacts@1
- task: ArchiveFiles@2
  inputs:
    rootFolderOrFile: '$(Build.BinariesDirectory)'
    includeRootFolder: true
    archiveType: 'zip'
    archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
    replaceExistingArchive: true
 
- task: PublishPipelineArtifact@1
  inputs:
    targetPath: '$(Pipeline.Workspace)'
    artifactType: 'pipeline'
    artifactName: 'drop'
```

I am new to Azure DEvOps and want to implement a simple ruby on rails website. Tutorials that I see online are mostly focused in .Net. Following is my created azure-pipeline.yml file. The code builds without error but when I create a release with a Ruby on Rails template it gives error. My error,
rakefile
and my build pipeline output looks like this. Can anyone help me on this or refer to some azure devops tutorials for ruby on rails.

```
# Ruby
# Package your Ruby project.
# Add steps that install rails, analyze code, save build artifacts, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/ruby

trigger:
- main

pool:
  vmImage: ubuntu-latest

steps:
- task: UseRubyVersion@0
  inputs:
    versionSpec: '>= 3.0'
    addToPath: true

- script: |
    CALL gem install bundler
    bundle init
    gem install rake
    bundle install --retry=3 --jobs=4
  displayName: 'bundle install'

- script: bundle exec rake
  displayName: 'bundle exec rake'


- task: PublishCodeCoverageResults@1
  inputs:
    codeCoverageTool: Cobertura
    summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
    reportDirectory: '$(System.DefaultWorkingDirectory)/**/coverage'

- task: PublishBuildArtifacts@1
- task: ArchiveFiles@2
  inputs:
    rootFolderOrFile: '$(Build.BinariesDirectory)'
    includeRootFolder: true
    archiveType: 'zip'
    archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
    replaceExistingArchive: true
 
- task: PublishPipelineArtifact@1
  inputs:
    targetPath: '$(Pipeline.Workspace)'
    artifactType: 'pipeline'
    artifactName: 'drop'
```

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清引 2025-01-31 03:31:21

CI输出告诉您问题在哪里。查找第24和53行。找不到Rakefile

在这里知道知道rake rake。它用于执行任务,例如,当您运行Rails DB:迁移时,Rake正在完成其工作。

因此,您应该在应用程序的根部添加一个rakefile,其中包括:

myapp/ rakefile

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require_relative "config/application"

Rails.application.load_tasks

编辑:

尝试将YML更改为:

- script: |
    echo "gem: --no-document" > ~/.gemrc
    gem install bundler
    bundle install --retry=3 --jobs=4
  displayName: 'bundle install'

- script: bundle exec rake
  displayName: 'bundle exec rake'

CI output is telling you where is the problem. Look for lines 24 and 53. No rakefile found.

Here to know abut Rake. It is used for doing tasks, for example when you run rails db:migrate, rake is doing its job.

So you should add a Rakefile to the root of your application, with:

myapp/Rakefile

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require_relative "config/application"

Rails.application.load_tasks

EDIT:

try to change your yml to:

- script: |
    echo "gem: --no-document" > ~/.gemrc
    gem install bundler
    bundle install --retry=3 --jobs=4
  displayName: 'bundle install'

- script: bundle exec rake
  displayName: 'bundle exec rake'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文