Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitlab ci状态判断不正确 #36

Open
pc10201 opened this issue Jul 14, 2021 · 4 comments
Open

gitlab ci状态判断不正确 #36

pc10201 opened this issue Jul 14, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@pc10201
Copy link

pc10201 commented Jul 14, 2021

使用的是默认模板
https://raw.fastgit.org/lddsb/drone-dingtalk-message/master/tpls/gitlab-ci.tpl

当gitlab ci上一个任务执行失败时,仍然返回的是sucess

TPL_BUILD_STATUS的值获取不正确

关键代码

stage: notify
image: lddsb/drone-dingtalk-message:1.2.7
script:
- drone-dingtalk
when: always

@lddsb
Copy link
Owner

lddsb commented Aug 12, 2021

这个目前确实是有问题。
然后我去看了一下GitLab的官方文档,似乎是 >=13.5 才有 CI_JOB_STATUS 这个环境变量,以前的版本都不具备判断job状态的能力,实在抱歉没有做足够的测试,导致了你有不好的使用体验。
我会继续想办法看怎么优雅地解决这个问题。

@lddsb lddsb added the bug Something isn't working label Aug 12, 2021
@pc10201
Copy link
Author

pc10201 commented Aug 17, 2021

也不能怪你,我现在用的是gitlab 14的版本,CI_JOB_STATUS这个变量的值不符合预期
我现在是分成两段来写的

notify_on_failure:
  stage: notify
  image: lddsb/drone-dingtalk-message:1.2.7
  script:
    - drone-dingtalk --build.status failure
  when: on_failure

notify_on_success:
  stage: notify
  image: lddsb/drone-dingtalk-message:1.2.7
  script:
    - drone-dingtalk --build.status success
  when: on_success

@lddsb
Copy link
Owner

lddsb commented Aug 17, 2021

也不能怪你,我现在用的是gitlab 14的版本,CI_JOB_STATUS这个变量的值不符合预期

我现在是分成两段来写的

notify_on_failure:

  stage: notify

  image: lddsb/drone-dingtalk-message:1.2.7

  script:

    - drone-dingtalk --build.status failure

  when: on_failure



notify_on_success:

  stage: notify

  image: lddsb/drone-dingtalk-message:1.2.7

  script:

    - drone-dingtalk --build.status success

  when: on_success

很高兴你想到其他方式解决了这个问题

@pc10201
Copy link
Author

pc10201 commented Aug 19, 2021

也不能怪你,我现在用的是gitlab 14的版本,CI_JOB_STATUS这个变量的值不符合预期
我现在是分成两段来写的

notify_on_failure:

  stage: notify

  image: lddsb/drone-dingtalk-message:1.2.7

  script:

    - drone-dingtalk --build.status failure

  when: on_failure



notify_on_success:

  stage: notify

  image: lddsb/drone-dingtalk-message:1.2.7

  script:

    - drone-dingtalk --build.status success

  when: on_success

很高兴你想到其他方式解决了这个问题

只是不太优雅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants