-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
50 lines (44 loc) · 1.72 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
stages:
- audit
- deploy
variables:
# CHANGE: your dependency files in the format of `<package-manager>:/tmp/packj/<your-dependency-file>`
DEPENDENCY_FILES: pypi:/tmp/packj/requirements.txt
packj-audit-job:
stage: audit
image: docker:20.10.16
services:
- alpine:3.17.2
- docker:dind # necessary for docker run
script:
- docker run --name packj-container -v /tmp:/tmp/packj -t ossillate/packj:latest
- docker cp ./requirements.txt packj-container:/tmp/packj/requirements.txt
- docker run -v /tmp:/tmp/packj -t ossillate/packj:latest audit -f $DEPENDENCY_FILES
# Project -> Settings -> Access Tokens, Create token with API scope.
# Project -> Settings -> CI/CD -> Variables, Store as CI_API_TOKEN
# GET /merge_requests?scope=all&state=opened&source_branch=:branch_name
# - |
# merge_request_iid=$( \
# curl --request GET \
# --header "PRIVATE-TOKEN: ${CI_API_TOKEN}" \
# "${CI_API_V4_URL}/merge_requests?scope=all&state=opened&source_branch=${CI_COMMIT_REF_NAME}" | \
# jq .[0].iid \
# )
# POST /projects/:id/merge_requests/:iid/notes
- TITLE='Test Packj Audit Issue'
- |
curl --request POST \
--header "PRIVATE-TOKEN: ${CI_API_TOKEN}" \
"${CI_API_V4_URL}/projects/${CI_CONCURRENT_PROJECT_ID}/issues?title=${TITLE}&labels=bug"
# - |
# echo $json_data |
# curl --request POST \
# --header "PRIVATE-TOKEN: ${CI_API_TOKEN}" \
# --header "Content-Type: application/json" \
# --data @- \
# "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/merge_requests/${merge_request_iid}/notes"
comment-job:
stage: deploy
environment: production
script:
- echo "Adding comment to PR..."