Skip to content

Commit 7a2297a

Browse files
committed
Merge branch 'admonitions' into 'master'
added more admonitions for warnings and examples See merge request CodeScoring/docs!650
2 parents e975255 + 65f8725 commit 7a2297a

34 files changed

Lines changed: 478 additions & 474 deletions

docs/agent/gitlab-ci.en.md

Lines changed: 53 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,34 @@ The CLI agent supports integration into Gitlab CI using the `.gitlab-ci.yaml` fi
99

1010
### Johnny Docker image
1111

12-
An example of the contents of the `.gitlab-ci.yaml` file when using a Docker image of the agent:
13-
14-
`<version>` must be replaced with the agent version. A list of current versions with descriptions is available in [Changelog](/changelog/johnny-changelog.en/).
15-
16-
```yaml
17-
stages:
18-
- test
19-
20-
sca:
21-
stage: test
22-
23-
script:
24-
- docker pull REGISTRY_URL/johnny-depp:<version>
25-
->
26-
docker run -v $(pwd):/code
27-
<registry-address>/johnny-depp
28-
--api_token $CODESCORING_API_TOKEN
29-
--api_url $CODESCORING_API_URL
30-
--ignore.git
31-
--ignore fixtures
32-
--ignore parsers
33-
.
34-
35-
artifacts:
36-
paths:
37-
-bom.json
38-
when: always
39-
expire_in: 1 week
40-
```
12+
!!! example "Example .gitlab-ci.yaml file (Docker image)"
13+
`<version>` must be replaced with the agent version. A list of current versions with descriptions is available in [Changelog](/changelog/johnny-changelog.en/).
14+
15+
```yaml
16+
stages:
17+
- test
18+
19+
sca:
20+
stage: test
21+
22+
script:
23+
- docker pull REGISTRY_URL/johnny-depp:<version>
24+
->
25+
docker run -v $(pwd):/code
26+
<registry-address>/johnny-depp
27+
--api_token $CODESCORING_API_TOKEN
28+
--api_url $CODESCORING_API_URL
29+
--ignore.git
30+
--ignore fixtures
31+
--ignore parsers
32+
.
33+
34+
artifacts:
35+
paths:
36+
-bom.json
37+
when: always
38+
expire_in: 1 week
39+
```
4140

4241
### Johnny binary file
4342

@@ -57,29 +56,28 @@ To use the agent binary file, you must first perform the following steps on the
5756
chmod +x /usr/local/bin/johnny
5857
```
5958

60-
An example of executing the binary file in `.gitlab-ci.yaml`:
61-
62-
```yaml
63-
stages:
64-
-test
65-
66-
sca:
67-
stage: test
68-
69-
script:
70-
->
71-
johnny
72-
scan dir
73-
--api_token $JOHNNY_API_TOKEN
74-
--api_url $JOHNNY_API_URL
75-
--ignore.git
76-
--ignore fixtures
77-
--ignore parsers
78-
.
79-
80-
artifacts:
81-
paths:
82-
-bom.json
83-
when: always
84-
expire_in: 1 week
85-
```
59+
!!! example "Example .gitlab-ci.yaml (binary file)"
60+
```yaml
61+
stages:
62+
-test
63+
64+
sca:
65+
stage: test
66+
67+
script:
68+
->
69+
johnny
70+
scan dir
71+
--api_token $JOHNNY_API_TOKEN
72+
--api_url $JOHNNY_API_URL
73+
--ignore.git
74+
--ignore fixtures
75+
--ignore parsers
76+
.
77+
78+
artifacts:
79+
paths:
80+
-bom.json
81+
when: always
82+
expire_in: 1 week
83+
```

docs/agent/gitlab-ci.md

Lines changed: 53 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,34 @@ hide:
99

1010
### Docker-образ Johnny
1111

12-
Пример содержания файла `.gitlab-ci.yaml` при использовании docker-образа консольного агента:
13-
14-
`<version>` необходимо заменить на версию агента. Список актуальных версий с описанием доступен на странице [Changelog](/changelog/johnny-changelog/).
15-
16-
```yaml
17-
stages:
18-
- test
19-
20-
sca:
21-
stage: test
22-
23-
script:
24-
- docker pull REGISTRY_URL/johnny-depp:<version>
25-
- >
26-
docker run -v $(pwd):/code
27-
<registry-address>/johnny-depp
28-
--api_token $CODESCORING_API_TOKEN
29-
--api_url $CODESCORING_API_URL
30-
--ignore .git
31-
--ignore fixtures
32-
--ignore parsers
33-
.
34-
35-
artifacts:
36-
paths:
37-
- bom.json
38-
when: always
39-
expire_in: 1 week
40-
```
12+
!!! example "Пример файла .gitlab-ci.yaml (Docker-образ)"
13+
`<version>` необходимо заменить на версию агента. Список актуальных версий с описанием доступен на странице [Changelog](/changelog/johnny-changelog/).
14+
15+
```yaml
16+
stages:
17+
- test
18+
19+
sca:
20+
stage: test
21+
22+
script:
23+
- docker pull REGISTRY_URL/johnny-depp:<version>
24+
- >
25+
docker run -v $(pwd):/code
26+
<registry-address>/johnny-depp
27+
--api_token $CODESCORING_API_TOKEN
28+
--api_url $CODESCORING_API_URL
29+
--ignore .git
30+
--ignore fixtures
31+
--ignore parsers
32+
.
33+
34+
artifacts:
35+
paths:
36+
- bom.json
37+
when: always
38+
expire_in: 1 week
39+
```
4140

4241
### Бинарный файл Johnny
4342

@@ -57,29 +56,28 @@ sca:
5756
chmod +x /usr/local/bin/johnny
5857
```
5958

60-
Пример вызова бинарного файла агента в `.gitlab-ci.yaml`:
61-
62-
```yaml
63-
stages:
64-
- test
65-
66-
sca:
67-
stage: test
68-
69-
script:
70-
- >
71-
johnny
72-
scan dir
73-
--api_token $JOHNNY_API_TOKEN
74-
--api_url $JOHNNY_API_URL
75-
--ignore .git
76-
--ignore fixtures
77-
--ignore parsers
78-
.
79-
80-
artifacts:
81-
paths:
82-
- bom.json
83-
when: always
84-
expire_in: 1 week
85-
```
59+
!!! example "Пример вызова в .gitlab-ci.yaml (бинарный файл)"
60+
```yaml
61+
stages:
62+
- test
63+
64+
sca:
65+
stage: test
66+
67+
script:
68+
- >
69+
johnny
70+
scan dir
71+
--api_token $JOHNNY_API_TOKEN
72+
--api_url $JOHNNY_API_URL
73+
--ignore .git
74+
--ignore fixtures
75+
--ignore parsers
76+
.
77+
78+
artifacts:
79+
paths:
80+
- bom.json
81+
when: always
82+
expire_in: 1 week
83+
```

docs/agent/jenkins-pipeline.en.md

Lines changed: 54 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,38 @@ The CLI agent supports integration into Jenkins in two ways: through `Jenkinsfil
1111

1212
### Using a Docker image
1313

14-
An example of adding agent to a `pipeline` using a Docker image:
15-
16-
```groovy
17-
pipeline {
18-
agent any
19-
20-
environment {
21-
CODESCORING_REGISTRY_URL='REGISTRY_URL'
22-
CODESCORING_AGENT_IMAGE='REGISTRY_URL/johnny-depp:<version>'
23-
CODESCORING_REGISTRY_CREDENTIALS=credentials('cs-registry-creds')
24-
CODESCORING_API_URL='https://localhost:8080'
25-
}
26-
27-
stages {
28-
29-
stage("Login to Codescoring docker registry") {
30-
steps {
31-
sh """
32-
docker login -u "$CODESCORING_REGISTRY_CREDENTIALS_USR" "$CODESCORING_REGISTRY_URL" -p "$CODESCORING_REGISTRY_CREDENTIALS_PSW"
33-
"""
34-
}
35-
}
36-
37-
stage('Run CodeScoring Agent') {
38-
steps {
39-
sh """
40-
docker run -v \$(pwd):/code --rm ${CODESCORING_AGENT_IMAGE} --api_token ${CODESCORING_API_TOKEN} --api_url ${CODESCORING_API_URL} --ignore .tmp --ignore fixtures --ignore .git .
41-
"""
42-
}
43-
}
44-
}
45-
}
46-
```
14+
!!! example "Example of adding agent to a pipeline (Docker image)"
15+
```groovy
16+
pipeline {
17+
agent any
18+
19+
environment {
20+
CODESCORING_REGISTRY_URL='REGISTRY_URL'
21+
CODESCORING_AGENT_IMAGE='REGISTRY_URL/johnny-depp:<version>'
22+
CODESCORING_REGISTRY_CREDENTIALS=credentials('cs-registry-creds')
23+
CODESCORING_API_URL='https://localhost:8080'
24+
}
25+
26+
stages {
27+
28+
stage("Login to Codescoring docker registry") {
29+
steps {
30+
sh """
31+
docker login -u "$CODESCORING_REGISTRY_CREDENTIALS_USR" "$CODESCORING_REGISTRY_URL" -p "$CODESCORING_REGISTRY_CREDENTIALS_PSW"
32+
"""
33+
}
34+
}
35+
36+
stage('Run CodeScoring Agent') {
37+
steps {
38+
sh """
39+
docker run -v \$(pwd):/code --rm ${CODESCORING_AGENT_IMAGE} --api_token ${CODESCORING_API_TOKEN} --api_url ${CODESCORING_API_URL} --ignore .tmp --ignore fixtures --ignore .git .
40+
"""
41+
}
42+
}
43+
}
44+
}
45+
```
4746

4847
### Using a binary file
4948

@@ -71,26 +70,25 @@ To use the console agent binary file, you must first perform the following steps
7170
chmod +x /usr/local/bin/johnny
7271
```
7372

74-
An example of executing the binary file in `pipeline`:
75-
76-
```groovy
77-
pipeline {
78-
agent any
79-
80-
environment {
81-
CODESCORING_API_URL='http://localhost:8001'
82-
CODESCORING_API_TOKEN='API_TOKEN'
83-
}
84-
85-
stages {
86-
87-
stage('Run CodeScoring Agent') {
88-
steps {
89-
sh """
90-
johnny scan dir --api_token ${CODESCORING_API_TOKEN} --api_url ${CODESCORING_API_URL} --ignore .tmp --ignore fixtures --ignore .git .
91-
"""
92-
}
93-
}
94-
}
95-
}
96-
```
73+
!!! example "Example of running agent in pipeline (binary file)"
74+
```groovy
75+
pipeline {
76+
agent any
77+
78+
environment {
79+
CODESCORING_API_URL='http://localhost:8001'
80+
CODESCORING_API_TOKEN='API_TOKEN'
81+
}
82+
83+
stages {
84+
85+
stage('Run CodeScoring Agent') {
86+
steps {
87+
sh """
88+
johnny scan dir --api_token ${CODESCORING_API_TOKEN} --api_url ${CODESCORING_API_URL} --ignore .tmp --ignore fixtures --ignore .git .
89+
"""
90+
}
91+
}
92+
}
93+
}
94+
```

0 commit comments

Comments
 (0)