gitlab-service.rkt (821B)
1 #lang racket/base 2 (provide gitlab-service@ gitlab-ci?) 3 4 (require "ci-service.rkt" racket/unit racket/list racket/string) 5 6 (define (gitlab-ci?) (and (getenv "CI") (getenv "GITLAB_CI"))) 7 8 (define-unit gitlab-service@ 9 (import) 10 (export ci-service^) 11 12 (define (query) 13 (define project-url (getenv "CI_PROJECT_URL")) 14 (define branch (getenv "CI_BUILD_REF_NAME")) 15 (list (cons 'service "gitlab") 16 (cons 'token (getenv "CODECOV_TOKEN")) 17 (cons 'branch branch) 18 (cons 'job (getenv "CI_PIPELINE_ID")) 19 (cons 'slug (getenv "CI_PROJECT_PATH")) 20 (cons 'tag (getenv "CI_BUILD_TAG")) 21 (cons 'build (getenv "CI_BUILD_ID")) 22 (cons 'build_url (and project-url branch (format "~a/tree/~a" project-url branch))) 23 (cons 'commit (getenv "CI_BUILD_REF")))))