Skip to content

Commit a31aa03

Browse files
committed
Merge branch 'develop' of github.com:rmtsrc/semaphore into prefers-color-scheme
2 parents bcf0f67 + 4eb6149 commit a31aa03

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1761
-579
lines changed

.dredd/hooks/helpers.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func addUserProjectRelation(pid int, user int) {
107107
_, err := store.CreateProjectUser(db.ProjectUser{
108108
ProjectID: pid,
109109
UserID: user,
110-
Admin: true,
110+
Role: db.ProjectOwner,
111111
})
112112
if err != nil {
113113
panic(err)

.dredd/hooks/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func main() {
7474
dbConnect()
7575
defer store.Close("")
7676
deleteUserProjectRelation(userProject.ID, userPathTestUser.ID)
77-
transaction.Request.Body = "{ \"user_id\": " + strconv.Itoa(userPathTestUser.ID) + ",\"admin\": true}"
77+
transaction.Request.Body = "{ \"user_id\": " + strconv.Itoa(userPathTestUser.ID) + ",\"role\": \"owner\"}"
7878
})
7979

8080
h.Before("project > /api/project/{project_id}/keys/{key_id} > Updates access key > 204 > application/json", capabilityWrapper("access_key"))

.github/FUNDING.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
44
patreon: # Replace with a single Patreon username
5-
open_collective: semaphore
5+
open_collective: # semaphore
66
ko_fi: fiftin
77
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
88
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry

.github/workflows/dev.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ on:
33
push:
44
branches:
55
- develop
6+
- roles
67

78
jobs:
89
build-local:
910
runs-on: [ubuntu-latest]
1011
steps:
1112
- uses: actions/setup-go@v3
12-
with: { go-version: 1.18 }
13+
with: { go-version: 1.19 }
1314

1415
- uses: actions/setup-node@v3
1516
with: { node-version: '16' }
@@ -41,7 +42,7 @@ jobs:
4142
# needs: build-local
4243
# steps:
4344
# - uses: actions/setup-go@v3
44-
# with: { go-version: 1.18 }
45+
# with: { go-version: 1.19 }
4546
#
4647
# - run: go install github.com/go-task/task/v3/cmd/task@latest
4748
#
@@ -97,7 +98,7 @@ jobs:
9798
needs: [test-db-migration]
9899
steps:
99100
- uses: actions/setup-go@v3
100-
with: { go-version: 1.18 }
101+
with: { go-version: 1.19 }
101102

102103
- run: go install github.com/go-task/task/v3/cmd/task@latest
103104

@@ -112,7 +113,7 @@ jobs:
112113
needs: [test-integration]
113114
steps:
114115
- uses: actions/setup-go@v3
115-
with: { go-version: 1.18 }
116+
with: { go-version: 1.19 }
116117

117118
- run: go install github.com/go-task/task/v3/cmd/task@latest
118119

@@ -146,7 +147,7 @@ jobs:
146147
# runs-on: [ubuntu-latest]
147148
# steps:
148149
# - uses: actions/setup-go@v3
149-
# with: { go-version: 1.18 }
150+
# with: { go-version: 1.19 }
150151

151152
# - run: go install github.com/go-task/task/v3/cmd/task@latest
152153

.github/workflows/release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: [ubuntu-latest]
1010
steps:
1111
- uses: actions/setup-go@v3
12-
with: { go-version: 1.18 }
12+
with: { go-version: 1.19 }
1313

1414
- uses: actions/setup-node@v3
1515
with: { node-version: '16' }
@@ -36,7 +36,7 @@ jobs:
3636
runs-on: [ubuntu-latest]
3737
steps:
3838
- uses: actions/setup-go@v3
39-
with: { go-version: 1.18 }
39+
with: { go-version: 1.19 }
4040

4141
- run: go install github.com/go-task/task/v3/cmd/task@latest
4242

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: [ubuntu-latest]
1010
steps:
1111
- uses: actions/setup-go@v3
12-
with: { go-version: 1.18 }
12+
with: { go-version: 1.19 }
1313

1414
- run: go install github.com/go-task/task/v3/cmd/task@latest
1515

CONTRIBUTING.md

+31-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Pull Requests
1+
## Pull Requests
22

33
When creating a pull-request you should:
44

@@ -8,7 +8,7 @@ When creating a pull-request you should:
88
- __Update api documentation:__ If your pull-request adding/modifying an API request, make sure you update the swagger documentation (`api-docs.yml`)
99
- __Run Api Tests:__ If your pull request modifies the API make sure you run the integration tests using dredd.
1010

11-
# Installation in a development environment
11+
## Installation in a development environment
1212

1313
- Check out the `develop` branch
1414
- [Install Go](https://golang.org/doc/install). Go must be >= v1.10 for all the tools we use to work
@@ -59,14 +59,32 @@ Dredd is used for API integration tests, if you alter the API in any way you mus
5959
matches the responses.
6060

6161
As Dredd and the application database config may differ it expects it's own config.json in the .dredd folder.
62-
The most basic configuration for this using a local docker container to run the database would be
63-
```json
64-
{
65-
"mysql": {
66-
"host": "0.0.0.0:3306",
67-
"user": "semaphore",
68-
"pass": "semaphore",
69-
"name": "semaphore"
70-
}
71-
}
72-
```
62+
63+
### How to run Dredd tests locally
64+
65+
1) Build Dredd hooks:
66+
````bash
67+
task compile:api:hooks
68+
```
69+
2) Install Dredd globally
70+
```bash
71+
npm install -g dredd
72+
```
73+
3) Create `./dredd/config.json` for Dredd. It must contain database connection same as used in Semaphore server.
74+
You can use any supported database dialect for tests. For example BoltDB.
75+
```json
76+
{
77+
"bolt": {
78+
"host": "/tmp/database.boltdb"
79+
},
80+
"dialect": "bolt"
81+
}
82+
```
83+
4) Start Semaphore server (add `--config` option if required):
84+
````bash
85+
./bin/semaphore server
86+
```
87+
5) Start Dredd tests
88+
```
89+
dredd --config ./.dredd/dredd.local.yml
90+
```

README.md

+7-27
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,18 @@
11
# Ansible Semaphore
22

3-
[![Twitter](https://img.shields.io/twitter/follow/semaphoreui?style=social&logo=twitter)](https://twitter.com/semaphoreui)
43
[![semaphore](https://snapcraft.io/semaphore/badge.svg)](https://snapcraft.io/semaphore)
5-
[![StackShare](https://img.shields.io/badge/tech-stack-008ff9)](https://stackshare.io/ansible-semaphore)
64
[![Join the chat at https://gitter.im/AnsibleSemaphore/semaphore](https://img.shields.io/gitter/room/AnsibleSemaphore/semaphore?logo=gitter)](https://gitter.im/AnsibleSemaphore/semaphore?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
75

8-
<!-- [![Release](https://img.shields.io/github/v/release/ansible-semaphore/semaphore.svg)](https://stackshare.io/ansible-semaphore) -->
9-
<!-- [![Godoc Reference](https://pkg.go.dev/badge/github.com/ansible-semaphore/semaphore?utm_source=godoc)](https://godoc.org/github.com/ansible-semaphore/semaphore) -->
10-
<!-- [![Codacy Badge](https://api.codacy.com/project/badge/Grade/89e0129c6ba64fe2b1ebe983f72a4eff)](https://www.codacy.com/app/ansible-semaphore/semaphore?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=ansible-semaphore/semaphore&amp;utm_campaign=Badge_Grade)
11-
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/89e0129c6ba64fe2b1ebe983f72a4eff)](https://www.codacy.com/app/ansible-semaphore/semaphore?utm_source=github.com&utm_medium=referral&utm_content=ansible-semaphore/semaphore&utm_campaign=Badge_Coverage) -->
6+
[![Twitter](https://img.shields.io/twitter/follow/semaphoreui?style=social&logo=twitter)](https://twitter.com/semaphoreui)
7+
8+
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/fiftin)
129

1310
Ansible Semaphore is a modern UI for Ansible. It lets you easily run Ansible playbooks, get notifications about fails, control access to deployment system.
1411

1512
If your project has grown and deploying from the terminal is no longer for you then Ansible Semaphore is what you need.
1613

1714
![responsive-ui-phone1](https://user-images.githubusercontent.com/914224/134777345-8789d9e4-ff0d-439c-b80e-ddc56b74fcee.png)
1815

19-
<!--
20-
![image](https://user-images.githubusercontent.com/914224/134411082-48235676-06d2-4d4b-b674-4ffe1e8d0d0d.png)
21-
22-
![semaphore](https://user-images.githubusercontent.com/914224/125253358-c214ed80-e312-11eb-952e-d96a1eba93f6.png)
23-
-->
24-
25-
26-
<!--
27-
- [Releases](https://github.com/ansible-semaphore/semaphore/releases)
28-
- [Installation](https://docs.ansible-semaphore.com/administration-guide/installation)
29-
- [Docker Hub](https://hub.docker.com/r/semaphoreui/semaphore/)
30-
- [Contribution](https://github.com/ansible-semaphore/semaphore/blob/develop/CONTRIBUTING.md)
31-
- [Troubleshooting](https://github.com/ansible-semaphore/semaphore/wiki/Troubleshooting)
32-
- [Roadmap](https://github.com/ansible-semaphore/semaphore/projects)
33-
- [UI Walkthrough](https://blog.strangeman.info/ansible/2017/08/05/semaphore-ui-guide.html) (external blog)
34-
-->
35-
3616
## Installation
3717

3818
### Full documentation
@@ -48,6 +28,8 @@ sudo semaphore user add --admin --name "Your Name" --login your_login --email yo
4828

4929
### Docker
5030

31+
https://hub.docker.com/r/semaphoreui/semaphore
32+
5133
`docker-compose.yml` for minimal configuration:
5234

5335
```yaml
@@ -66,7 +48,6 @@ services:
6648
- /path/to/data/home:/etc/semaphore # config.json location
6749
- /path/to/data/lib:/var/lib/semaphore # database.boltdb location (Not required if using mysql or postgres)
6850
```
69-
https://hub.docker.com/r/semaphoreui/semaphore
7051
7152
## Demo
7253
@@ -80,6 +61,8 @@ API description: https://ansible-semaphore.com/api-docs/
8061
8162
## Contributing
8263
64+
If you want to write an article about Ansible or Semaphore, contact [@fiftin](https://github.com/fiftin) and we will place your article in our [Blog](https://www.ansible-semaphore.com/blog/) with link to your profile.
65+
8366
PR's & UX reviews are welcome!
8467
8568
Please follow the [contribution](https://github.com/ansible-semaphore/semaphore/blob/develop/CONTRIBUTING.md) guide. Any questions, please open an issue.
@@ -93,9 +76,6 @@ All releases after 2.5.1 are signed with the gpg public key
9376

9477
If you like Ansible Semaphore, you can support the project development on [Ko-fi](https://ko-fi.com/fiftin).
9578

96-
[<img src="https://user-images.githubusercontent.com/914224/203517453-4febf7f6-debb-4be9-b6a2-a3b19f5d9f9a.png">](https://ko-fi.com/fiftin)
97-
98-
9979
## License
10080

10181
MIT License

api-docs.yml

+78-19
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,24 @@ definitions:
4444
format: password
4545
description: Password
4646

47+
LoginMetadata:
48+
type: object
49+
properties:
50+
oidc_providers:
51+
type: array
52+
description: List of OIDC providers
53+
items:
54+
type: object
55+
properties:
56+
id:
57+
type: string
58+
description: ID of the provider, used in the login URL
59+
x-example: mysso
60+
name:
61+
type: string
62+
description: Text to show on the login button
63+
x-example: Sign in with MySSO
64+
4765
UserRequest:
4866
type: object
4967
properties:
@@ -610,6 +628,17 @@ paths:
610628

611629
# Authentication
612630
/auth/login:
631+
get:
632+
tags:
633+
- authentication
634+
summary: Fetches login metadata
635+
description: Fetches metadata for login, such as available OIDC providers
636+
security: []
637+
responses:
638+
200:
639+
description: Login metadata
640+
schema:
641+
$ref: "#/definitions/LoginMetadata"
613642
post:
614643
tags:
615644
- authentication
@@ -637,6 +666,38 @@ paths:
637666
204:
638667
description: Your session was successfully nuked
639668

669+
/auth/oidc/{provider_id}/login:
670+
parameters:
671+
- name: provider_id
672+
in: path
673+
type: string
674+
required: true
675+
x-example: "mysso"
676+
get:
677+
tags:
678+
- authentication
679+
summary: Begin OIDC authentication flow and redirect to OIDC provider
680+
description: The user agent is redirected to this endpoint when chosing to sign in via OIDC
681+
responses:
682+
302:
683+
description: Redirection to the OIDC provider on success, or to the login page on error
684+
685+
/auth/oidc/{provider_id}/redirect:
686+
parameters:
687+
- name: provider_id
688+
in: path
689+
type: string
690+
required: true
691+
x-example: "mysso"
692+
get:
693+
tags:
694+
- authentication
695+
summary: Finish OIDC authentication flow, upon succes you will be logged in
696+
description: The user agent is redirected here by the OIDC provider to complete authentication
697+
responses:
698+
302:
699+
description: Redirection to the Semaphore root URL on success, or to the login page on error
700+
640701
# User Tokens
641702
/user/:
642703
get:
@@ -895,7 +956,7 @@ paths:
895956
in: query
896957
required: true
897958
type: string
898-
enum: [name, username, email, admin]
959+
enum: [name, username, email, role]
899960
description: sorting name
900961
x-example: email
901962
- name: order
@@ -926,8 +987,9 @@ paths:
926987
user_id:
927988
type: integer
928989
minimum: 2
929-
admin:
930-
type: boolean
990+
role:
991+
type: string
992+
example: owner
931993
responses:
932994
204:
933995
description: User added
@@ -942,24 +1004,21 @@ paths:
9421004
responses:
9431005
204:
9441006
description: User removed
945-
/project/{project_id}/users/{user_id}/admin:
946-
parameters:
947-
- $ref: "#/parameters/project_id"
948-
- $ref: "#/parameters/user_id"
949-
post:
950-
tags:
951-
- project
952-
summary: Makes user admin
953-
responses:
954-
204:
955-
description: User made administrator
956-
delete:
957-
tags:
958-
- project
959-
summary: Revoke admin privileges
1007+
put:
1008+
parameters:
1009+
- name: Project User
1010+
in: body
1011+
required: true
1012+
schema:
1013+
type: object
1014+
properties:
1015+
role:
1016+
type: string
1017+
example: owner
1018+
summary: Update user role
9601019
responses:
9611020
204:
962-
description: User admin privileges revoked
1021+
description: User updated
9631022

9641023
# project access keys
9651024
/project/{project_id}/keys:

0 commit comments

Comments
 (0)