如何在管道运行期间将文件从分支上的一个目录移至第二个目录? GitLab

发布于 2025-02-10 09:07:50 字数 1120 浏览 1 评论 0原文

我已经创建了Docs文件夹,它应该包含报告文件。 我试图将内容从临时创建的诱惑文件夹转移到Docs文件夹,然后将从文档到公共文件夹的所有内容复制到访问该魅力报告所在的页面。我正在执行该过程,以简单地将文件从Allure文件夹复制到公共文件夹,以获取有关以前运行的历史记录。也许有更好的方法可以做到?我想存储一些X时间的旧报告(例如,2天,能够看到Allure出错的问题是有问题的)然后删除旧的,而不是删除尚未达到的最新内容”观点”。因此,这是我的YML文件:

stages:
  - testing
  - deploy 

docker_job:
  stage: testing
  tags:
    - docker
  image: atools/chrome-headless:java11-node14-latest 

  before_script:
    - npm ci 
    - npx playwright install
    - npm install allure-commandline --save-dev
  script: #||true
    - npx playwright test
  
    
  after_script:
    - npx allure generate allure-results
  rules:
      - when: always
  allow_failure: true
  artifacts: 
    when: always
    paths:
      - ./allure-report
    expire_in: 1 day 

pages: 
  stage: deploy
  script:
    - mkdir public 
    - mv ./allure-report/* Docs
    - cp -R ./Docs/* public
  artifacts:
    paths:
      - public
  rules:
    - when: always

一切都很好,但是它不起作用-MV ./allure-report/* docs -cp -r ./docs/* public什么都不做,或者我看不到任何效果。请帮助我正确解决这个问题。

逻辑上有明显的漏洞,IDK尝试了很多变体,但它们都无法使用。 可以通过我的方式完成吗?

I have created Docs folder and it should contain report files.
I'm trying to move content from temporary created Allure folder to Docs folder and then copy everything from Docs to public folder to get access to Pages on which that Allure report will be located. I'm doing that process insted of simple copying files from allure folder to public folder to get history about previous runs. Maybe there is some better way to do it ? I'd like to store old reports for some X time (for example for 2 days, to be able to see on ALlure what was wrong is there are some problems) and then delete old ones, not deleting latest which have not reached "deleting point". So, here is my yml file:

stages:
  - testing
  - deploy 

docker_job:
  stage: testing
  tags:
    - docker
  image: atools/chrome-headless:java11-node14-latest 

  before_script:
    - npm ci 
    - npx playwright install
    - npm install allure-commandline --save-dev
  script: #||true
    - npx playwright test
  
    
  after_script:
    - npx allure generate allure-results
  rules:
      - when: always
  allow_failure: true
  artifacts: 
    when: always
    paths:
      - ./allure-report
    expire_in: 1 day 

pages: 
  stage: deploy
  script:
    - mkdir public 
    - mv ./allure-report/* Docs
    - cp -R ./Docs/* public
  artifacts:
    paths:
      - public
  rules:
    - when: always

Everything is going good but it doesn't work - mv ./allure-report/* Docs
- cp -R ./Docs/* public are doing nothing or I just can't see any effect. Help me please to correctly solve that problem.

Maybe there is obvious holes in logic, idk, have tried a lot of variants but they all don't work.
Can it be done by my way at all?

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

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

发布评论

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

评论(1

我恋#小黄人 2025-02-17 09:07:50

好的,所以我已经用我的git.conf电子邮件/名称进行了“登录”,然后使用auth token我将这些文物推向Docs文件夹,看起来很像:

stages:
    - testing
    - deploy

docker_job:
    stage: testing
    tags:
        - docker
    image: atools/chrome-headless:java11-node14-latest

    before_script:
        - npm ci
        - npx playwright install
        - npm install allure-commandline --save-dev
    script: #||true
        - npx playwright test

    after_script:
        - npx allure generate allure-results
    rules:
        - when: always
    allow_failure: true
    artifacts:
        when: always
        paths:
            - ./allure-report
        expire_in: 15 mins

pages:
    stage: deploy
    script:
        - cp -r -u ./allure-report/* Docs
        - cp -R ./Docs/* public
        - git config --global user.email "mail"
        - git config --global user.name "name"
        - git remote set-url origin https://gitlab-ci-token:${token}@gitlab.com/proj_link
        - git checkout main
        - git add Docs
        - git commit -m "assets"
        - git push
    artifacts:
        paths:
            - public
    rules:
        - when: always


okay, so I have done it with "logging in" with my git.conf email/name, then using auth token I did a push of these artifacts to Docs folder, looks like:

stages:
    - testing
    - deploy

docker_job:
    stage: testing
    tags:
        - docker
    image: atools/chrome-headless:java11-node14-latest

    before_script:
        - npm ci
        - npx playwright install
        - npm install allure-commandline --save-dev
    script: #||true
        - npx playwright test

    after_script:
        - npx allure generate allure-results
    rules:
        - when: always
    allow_failure: true
    artifacts:
        when: always
        paths:
            - ./allure-report
        expire_in: 15 mins

pages:
    stage: deploy
    script:
        - cp -r -u ./allure-report/* Docs
        - cp -R ./Docs/* public
        - git config --global user.email "mail"
        - git config --global user.name "name"
        - git remote set-url origin https://gitlab-ci-token:${token}@gitlab.com/proj_link
        - git checkout main
        - git add Docs
        - git commit -m "assets"
        - git push
    artifacts:
        paths:
            - public
    rules:
        - when: always


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