-
Notifications
You must be signed in to change notification settings - Fork 0
/
orb.yml
149 lines (142 loc) · 5.85 KB
/
orb.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
version: 2.1
description: |
Easily install and use Sonar on CircleCI. Sonar is a Docker utility tool
useful for when you want to learn more about your Docker images. You can list
and compare Docker images, their tags, and pull metrics from Docker Hub.
Currently supports Linux on amd64.
display:
home_url: "https://circleci.com/developer/orbs/orb/hubci/sonar"
source_url: "https://github.com/hubci/sonar-orb"
orbs:
os-detect: circleci/os-detect@0.2
commands:
install:
description: |
Install Sonar in a build (for amd64 Linux).
parameters:
version:
description: |
The Sonar version. This is a full SemVer version.
type: string
steps:
- os-detect/init
- run:
name: "Install Sonar"
command: |
dlURL="https://github.com/felicianotech/sonar/releases/download/v<<parameters.version>>/sonar-v<<parameters.version>>-linux-amd64.tar.gz"
curl -sSL $dlURL | $SUDO tar -xz -C /usr/local/bin sonar
update-readme:
description: |
Update the readme (description) of a Docker image on Docker Hub using the
contents of a text file. As Docker Hub readmes support Markdown, the most
common usecase is to use a Git repository's README.md file to update
Docker Hub.
parameters:
file:
description: The filepath to the text file to use.
type: string
default: ./README.md
image:
description: The image name whose Docker Hub readme shall be updated.
type: string
docker-username:
description: |
Environment variable (envar) that contains the Docker username. This
is where the variable name is specified. The envar value itself can
be set via project specific envars, context, the CircleCI API, and
more. Reference: https://circleci.com/docs/2.0/env-vars/
type: env_var_name
default: DOCKER_USER
docker-password:
description: |
Environment variable (envar) that contains the Docker password or API
token. This is where the variable name is specified. The envar value
itself can be set via project specific envars, context, the CircleCI
API, and more. Be sure not to include your password or token in plain
text in your config.Reference: https://circleci.com/docs/2.0/env-vars/
type: env_var_name
default: DOCKER_PASS
steps:
- run: |
if [ ! -f <<parameters.file>> ]; then
echo "The file does not exist."
exit 1
fi
sonar set readme <<parameters.image>> <<parameters.file>>
update-summary:
description: |
Update the summary of a Docker image on Docker Hub from a string. A
Docker Hub image summary is limited to 100 characters.
parameters:
summary:
description: The string to set as the summary. Limited to 100 characters.
type: string
image:
description: The image name whose Docker Hub summary shall be updated.
type: string
docker-username:
description: |
Environment variable (envar) that contains the Docker username. This
is where the variable name is specified. The envar value itself can
be set via project specific envars, context, the CircleCI API, and
more. Reference: https://circleci.com/docs/2.0/env-vars/
type: env_var_name
default: DOCKER_USER
docker-password:
description: |
Environment variable (envar) that contains the Docker password or API
token. This is where the variable name is specified. The envar value
itself can be set via project specific envars, context, the CircleCI
API, and more. Be sure not to include your password or token in plain
text in your config.Reference: https://circleci.com/docs/2.0/env-vars/
type: env_var_name
default: DOCKER_PASS
steps:
- run: sonar set summary <<parameters.image>> <<parameters.summary>>
jobs:
update-readme:
docker:
- image: cimg/base:2020.12
description: |
Update the readme (description) of a Docker image on Docker Hub using the
contents of a text file. As Docker Hub readmes support Markdown, the most
common usecase is to use a Git repository's README.md file to update
Docker Hub.
parameters:
version:
description: |
The Sonar version. This is a full SemVer version.
type: string
file:
description: The filepath to the text file to use.
type: string
default: ./README.md
image:
description: The image name whose Docker Hub readme shall be updated.
type: string
docker-username:
description: |
Environment variable (envar) that contains the Docker username. This
is where the variable name is specified. The envar value itself can
be set via project specific envars, context, the CircleCI API, and
more. Reference: https://circleci.com/docs/2.0/env-vars/
type: env_var_name
default: DOCKER_USER
docker-password:
description: |
Environment variable (envar) that contains the Docker password or API
token. This is where the variable name is specified. The envar value
itself can be set via project specific envars, context, the CircleCI
API, and more. Be sure not to include your password or token in plain
text in your config.Reference: https://circleci.com/docs/2.0/env-vars/
type: env_var_name
default: DOCKER_PASS
steps:
- checkout
- install:
version: <<parameters.version>>
- update-readme:
file: <<parameters.file>>
image: <<parameters.image>>
docker-username: <<parameters.docker-username>>
docker-password: <<parameters.docker-password>>