From d6fd85f536f2b328faae42572da3337a4aa4417f Mon Sep 17 00:00:00 2001 From: xiaoxiaoqiong Date: Mon, 30 May 2022 11:18:24 +0800 Subject: [PATCH] =?UTF-8?q?Repository.url=E9=87=8D=E5=86=99=EF=BC=8C?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E9=A1=B9=E7=9B=AE=E6=97=B6=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/ci/pipelines_controller.rb | 1 + app/models/repository.rb | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/app/controllers/ci/pipelines_controller.rb b/app/controllers/ci/pipelines_controller.rb index 288059659..d6eee1387 100644 --- a/app/controllers/ci/pipelines_controller.rb +++ b/app/controllers/ci/pipelines_controller.rb @@ -81,6 +81,7 @@ class Ci::PipelinesController < Ci::BaseController repo_branch: pipeline.branch, repo_config: pipeline.file_name } + Rails.logger.info("########create_params===#{create_params.to_json}") repo = Ci::Repo.create_repo(create_params) repo end diff --git a/app/models/repository.rb b/app/models/repository.rb index a012b449a..12cc2fa38 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -48,6 +48,10 @@ class Repository < ApplicationRecord self.identifier.parameterize end + def url + self['url'].blank? ? "#{Rails.application.config_for(:configuration)['platform_url']}/#{self.owner&.login}/#{self.identifier}.git" : self['url'] + end + # with repository is mirror def set_mirror! self.build_mirror(status: Mirror.statuses[:waiting]).save