Skip to content

Commit 203a3aa

Browse files
committed
Merge branch 'mk/service-accounts-ui' into feat/service-accounts
2 parents 88c7867 + e2a26a1 commit 203a3aa

File tree

118 files changed

+5388
-809
lines changed

Some content is hidden

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

118 files changed

+5388
-809
lines changed

.semaphore/daily-builds.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,11 +725,11 @@ blocks:
725725
jobs:
726726
- name: JS - dependencies
727727
commands:
728-
- make check.js.deps APP_DIRECTORY=assets
728+
- make check.js.deps APP_DIRECTORY=assets SCAN_RESULT_DIR=../out
729729
- name: JS - code
730730
commands:
731731
- export PATH=$PATH:/home/semaphore/.local/bin
732-
- make check.js.code APP_DIRECTORY=assets
732+
- make check.js.code APP_DIRECTORY=assets SCAN_RESULT_DIR=../out
733733
- name: Elixir - dependencies
734734
commands:
735735
- make check.ex.deps CHECK_DEPS_OPTS='--ignore-packages phoenix'

.semaphore/semaphore.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,11 +789,11 @@ blocks:
789789
jobs:
790790
- name: JS - dependencies
791791
commands:
792-
- make check.js.deps APP_DIRECTORY=assets
792+
- make check.js.deps APP_DIRECTORY=assets SCAN_RESULT_DIR=../out
793793
- name: JS - code
794794
commands:
795795
- export PATH=$PATH:/home/semaphore/.local/bin
796-
- make check.js.code APP_DIRECTORY=assets
796+
- make check.js.code APP_DIRECTORY=assets SCAN_RESULT_DIR=../out
797797
- name: Elixir - dependencies
798798
commands:
799799
- make check.ex.deps CHECK_DEPS_OPTS='--ignore-packages phoenix'

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ DOCKER_BUILD_PATH=.
7676
EX_CATCH_WARRNINGS_FLAG=--warnings-as-errors
7777
CHECK_DEPS_EXTRA_OPTS?=-w feature_provider,grpc_health_check,tentacat,util,watchman,fun_registry,sentry_grpc,traceman,cacheman,log_tee,spec,proto,sys2app,looper,job_matrix,definition_validator,gofer_client,open_api_spex,when,uuid,esaml,openid_connect,block
7878
ROOT_MAKEFILE_PATH := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
79+
SCAN_RESULT_DIR?=out
7980

8081
#
8182
# Security checks
@@ -111,10 +112,10 @@ ifeq ($(CI),)
111112
-v $$(pwd):/app \
112113
-v $(ROOT_MAKEFILE_PATH)/security-toolbox:$(SECURITY_TOOLBOX_TMP_DIR) \
113114
registry.semaphoreci.com/ruby:3 \
114-
bash -c 'cd $(APP_DIRECTORY) && $(SECURITY_TOOLBOX_TMP_DIR)/dependencies --language $(LANGUAGE) -d $(CHECK_DEPS_OPTS)'
115+
bash -c 'cd $(APP_DIRECTORY) && $(SECURITY_TOOLBOX_TMP_DIR)/dependencies --language $(LANGUAGE) -d --output-dir $(SCAN_RESULT_DIR) $(CHECK_DEPS_OPTS)'
115116
else
116117
# ruby version is set in prologue
117-
cd $(APP_DIRECTORY) && $(ROOT_MAKEFILE_PATH)/security-toolbox/dependencies --language $(LANGUAGE) -d $(CHECK_DEPS_OPTS)
118+
cd $(APP_DIRECTORY) && $(ROOT_MAKEFILE_PATH)/security-toolbox/dependencies --language $(LANGUAGE) -d --output-dir $(SCAN_RESULT_DIR) $(CHECK_DEPS_OPTS)
118119
endif
119120

120121
check.ex.deps:

ee/rbac/assets/permissions.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ permissions:
7070
description: "View the existing dashboards within the organization."
7171
- name: "organization.dashboards.manage"
7272
description: "Create new dashboard views."
73+
- name: "organization.service_accounts.view"
74+
description: "View service accounts within the organization."
75+
- name: "organization.service_accounts.manage"
76+
description: "Manage service accounts within the organization."
7377
project:
7478
- name: "project.view"
7579
description: "Access the project. This permission is needed to see any page within the project."

ee/rbac/assets/roles.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ roles:
3939
- "organization.custom_roles.view"
4040
- "organization.dashboards.view"
4141
- "organization.dashboards.manage"
42+
- "organization.service_accounts.view"
43+
- "organization.service_accounts.manage"
4244
- name: "Admin"
4345
description: "Admins can modify settings within the organization or any of its projects. However, they do not have access to billing information, and they cannot change general organization details, such as the organization name and URL."
4446
maps_to: "Admin"
@@ -77,6 +79,8 @@ roles:
7779
- "organization.dashboards.view"
7880
- "organization.dashboards.manage"
7981
- "project.delete"
82+
- "organization.service_accounts.view"
83+
- "organization.service_accounts.manage"
8084
- name: "Member"
8185
description: "Members can access the organization's homepage and the projects they are assigned to. However, they are not able to modify any settings."
8286
permissions:

front/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ RUN mix sentry_recompile && mix compile --warnings-as-errors
4545
# -- elixir stage
4646

4747
# -- node stage
48-
FROM node:16-alpine as node
48+
FROM node:16-alpine AS node
4949
WORKDIR /assets
5050
COPY front/assets/package.json front/assets/package-lock.json ./
5151
RUN npm set progress=false && npm install
@@ -56,15 +56,15 @@ COPY front/assets ./
5656
FROM elixir AS dev
5757
WORKDIR /app
5858
RUN apk update \
59-
&& apk add --no-cache chromium-chromedriver inotify-tools bash gnupg entr
59+
&& apk add --no-cache chromium-chromedriver inotify-tools bash gnupg
6060

6161
COPY --from=elixir /elixir ./
6262
COPY --from=node /assets ./assets
6363
WORKDIR /app/assets
6464
RUN node build.js
6565
WORKDIR /app
6666

67-
CMD ["sh", "-c", "find lib config | entr -n -r mix phx.server"]
67+
CMD ["sh", "-c", "elixir --name [email protected] --cookie mycookie -S mix phx.server"]
6868
# -- dev stage
6969

7070
# -- builder stage - build artifacts are created here

front/Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ CACHE_PORT=6379
2929
CACHE_POOL_SIZE=5
3030
AMQP_URL=amqp://0.0.0.0:5672
3131

32+
#
33+
# Internal API URLs env file
34+
#
35+
INTERNAL_API_ENV_FILE = env/.env.internal-apis
36+
3237
CONTAINER_ENV_VARS = \
3338
-e CI=$(CI) \
3439
-e MIX_ENV=$(MIX_ENV) \
@@ -42,7 +47,8 @@ CONTAINER_ENV_VARS = \
4247
-e SEED_PROJECTS="initializing_failed,zebra,guard,errored,test_results,test_results_debug,after_pipeline,bitbucket" \
4348
-e SEED_CLOUD_MACHINES=true \
4449
-e SECRET_KEY_BASE="keyboard-cat-please-use-this-only-for-dev-and-testing-it-is-insecure" \
45-
-e SESSION_SIGNING_SALT="keyboard-cat-please-use-this-only-for-dev-and-testing-it-is-insecure"
50+
-e SESSION_SIGNING_SALT="keyboard-cat-please-use-this-only-for-dev-and-testing-it-is-insecure" \
51+
--env-file $(INTERNAL_API_ENV_FILE)
4652

4753

4854
CONTAINER_CE_ENV_VARS =\
@@ -55,7 +61,8 @@ CONTAINER_CE_ENV_VARS =\
5561
-e WORKFLOW_TEMPLATES_YAMLS_PATH="/app/workflow_templates/ce" \
5662
-e EXCLUDE_STUBS="GoferMock" \
5763
-e SECRET_KEY_BASE="keyboard-cat-please-use-this-only-for-dev-and-testing-it-is-insecure" \
58-
-e SESSION_SIGNING_SALT="keyboard-cat-please-use-this-only-for-dev-and-testing-it-is-insecure"
64+
-e SESSION_SIGNING_SALT="keyboard-cat-please-use-this-only-for-dev-and-testing-it-is-insecure" \
65+
--env-file $(INTERNAL_API_ENV_FILE)
5966

6067
test.ex.setup: export MIX_ENV=test
6168
test.ex.setup:

front/assets/build.js

Lines changed: 71 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,55 @@
11
const esbuild = require('esbuild')
22
const fs = require('fs-extra')
33
const path = require('path')
4+
const { exec } = require('child_process')
5+
const { promisify } = require('util')
46

7+
const execAsync = promisify(exec)
58
const bundle = true
69
const logLevel = process.env.ESBUILD_LOG_LEVEL || 'silent'
710
const watch = !!process.env.ESBUILD_WATCH
11+
const isProd = process.env.MIX_ENV === 'prod' || process.env.NODE_ENV === 'production'
812

913
const plugins = [
1014
// Add and configure plugins here
1115
]
1216

1317
const outputDir = '../priv/static/assets'
1418

19+
// Function to process CSS files
20+
const processCss = async () => {
21+
console.log('Processing CSS files...')
22+
23+
try {
24+
// Process main.css which imports all other CSS files
25+
const inputFile = 'css/main.css'
26+
const outputFile = path.join(outputDir, 'css/app.css')
27+
28+
// Set NODE_ENV for PostCSS to handle minification
29+
const env = isProd ? 'NODE_ENV=production' : 'NODE_ENV=development'
30+
const postcssCmd = `${env} npx postcss ${inputFile} -o ${outputFile}`
31+
32+
await execAsync(postcssCmd)
33+
console.log(`CSS processed successfully (${isProd ? 'production' : 'development'} mode)`)
34+
35+
} catch (error) {
36+
console.error('Error processing CSS:', error)
37+
throw error
38+
}
39+
}
40+
1541
// Function to copy static assets
16-
const copyAssets = () => {
17-
console.log('Copying original assets to output directory...')
42+
const copyAssets = async () => {
43+
console.log('Copying static assets to output directory...')
1844

1945
fs.ensureDirSync(path.join(outputDir, 'css'))
2046
fs.ensureDirSync(path.join(outputDir, 'fonts'))
2147
fs.ensureDirSync(path.join(outputDir, 'images'))
2248

23-
fs.copySync('css', path.join(outputDir, 'css'), { overwrite: true })
49+
// Process CSS files
50+
await processCss()
51+
52+
// Copy fonts and images
2453
fs.copySync('fonts', path.join(outputDir, 'fonts'), { overwrite: true })
2554
fs.copySync('images', path.join(outputDir, 'images'), { overwrite: true })
2655

@@ -53,18 +82,53 @@ const buildOptions = {
5382
}
5483

5584
if (watch) {
56-
esbuild.context(buildOptions).then(context => {
85+
esbuild.context(buildOptions).then(async context => {
5786
context.watch()
58-
copyAssets()
87+
await copyAssets()
88+
89+
const chokidar = require('chokidar')
90+
const cssDir = path.join(__dirname, 'css')
91+
92+
const cssWatcher = chokidar.watch(cssDir, {
93+
persistent: true,
94+
ignoreInitial: true,
95+
usePolling: true, // REQUIRED for macOS Docker
96+
interval: 1000,
97+
binaryInterval: 1000,
98+
awaitWriteFinish: {
99+
stabilityThreshold: 500,
100+
pollInterval: 100
101+
},
102+
useFsEvents: false,
103+
alwaysStat: true,
104+
depth: 99,
105+
atomic: false
106+
})
107+
108+
cssWatcher
109+
.on('change', async (path) => {
110+
// Only process CSS files
111+
if (path.endsWith('.css')) {
112+
console.log('CSS file changed, reprocessing...')
113+
try {
114+
await processCss()
115+
} catch (error) {
116+
console.error('Error processing CSS:', error)
117+
}
118+
}
119+
})
120+
.on('ready', () => console.log('CSS watcher ready'))
121+
59122
process.stdin.on('close', () => {
123+
cssWatcher.close()
60124
context.dispose()
61125
process.exit(0)
62126
})
63127
process.stdin.resume()
64128
})
65129
} else {
66-
esbuild.build(buildOptions).then(() => {
67-
copyAssets()
130+
esbuild.build(buildOptions).then(async () => {
131+
await copyAssets()
68132
}).catch(error => {
69133
console.error('Build error:', error)
70134
process.exit(1)

front/assets/css/app-semaphore-min.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

front/assets/css/app-semaphore.css

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2624,7 +2624,7 @@ template {
26242624
}
26252625
/* Modules */
26262626
/*
2627-
2627+
26282628
BOX SIZING
26292629
26302630
*/
@@ -2656,7 +2656,7 @@ blockquote,
26562656
figcaption,
26572657
figure,
26582658
textarea,
2659-
table,
2659+
table,
26602660
td,
26612661
th,
26622662
tr,
@@ -2795,6 +2795,8 @@ img { max-width: 100%; }
27952795
.b--indigo { border-color: #1570ff; }
27962796
.b--dark-indigo { border-color: #00359f; }
27972797
.b--orange { border-color: #fd7e14; }
2798+
.b--yellow { border-color: #FBC335; }
2799+
.b--blue { border-color: #2196F3; }
27982800
.b--purple { border-color: #8658d6; }
27992801
.b--dark-purple { border-color: #5122a5; }
28002802
.b--dark-brown { border-color: #974510; }
@@ -2895,7 +2897,7 @@ img { max-width: 100%; }
28952897
border-top-right-radius: 0;
28962898
border-bottom-right-radius: 0;
28972899
}
2898-
/*
2900+
/*
28992901
@media (--breakpoint-not-small) {
29002902
.br0-ns { border-radius: 0; }
29012903
.br1-ns { border-radius: .125rem; }
@@ -3000,7 +3002,7 @@ img { max-width: 100%; }
30003002
.b--dashed { border-style: dashed; }
30013003
.b--solid { border-style: solid; }
30023004
.b--none { border-style: none; }
3003-
/*
3005+
/*
30043006
@media (--breakpoint-not-small) {
30053007
.b--dotted-ns { border-style: dotted; }
30063008
.b--dashed-ns { border-style: dashed; }
@@ -3192,7 +3194,7 @@ img { max-width: 100%; }
31923194
bottom: 0;
31933195
left: 0;
31943196
}
3195-
/*
3197+
/*
31963198
@media (--breakpoint-not-small) {
31973199
.top-0-ns { top: 0; }
31983200
.left-0-ns { left: 0; }
@@ -3798,7 +3800,7 @@ code, .code, pre {
37983800
*/
37993801
.i { font-style: italic; }
38003802
.fs-normal { font-style: normal; }
3801-
/*
3803+
/*
38023804
@media (--breakpoint-not-small) {
38033805
.i-ns { font-style: italic; }
38043806
.fs-normal-ns { font-style: normal; }
@@ -3850,7 +3852,7 @@ code, .code, pre {
38503852
.fw7 { font-weight: 700; }
38513853
.fw8 { font-weight: 800; }
38523854
.fw9 { font-weight: 900; }
3853-
/*
3855+
/*
38543856
@media (--breakpoint-not-small) {
38553857
.normal-ns { font-weight: normal; }
38563858
.b-ns { font-weight: bold; }
@@ -3896,7 +3898,7 @@ code, .code, pre {
38963898
/*
38973899
38983900
FORMS
3899-
3901+
39003902
*/
39013903
.input-reset {
39023904
-webkit-appearance: none;
@@ -4037,7 +4039,7 @@ code, .code, pre {
40374039
.tracked { letter-spacing: .1em; }
40384040
.tracked-tight { letter-spacing: -.05em; }
40394041
.tracked-mega { letter-spacing: .25em; }
4040-
/*
4042+
/*
40414043
@media (--breakpoint-not-small) {
40424044
.tracked-ns { letter-spacing: .1em; }
40434045
.tracked-tight-ns { letter-spacing: -.05em; }
@@ -4585,6 +4587,7 @@ code, .code, pre {
45854587
.bg-washed-purple { background-color: #f3ecff; }
45864588
/* Yellows */
45874589
.yellow { color: #FBC335; }
4590+
.gold { color: #FBC335; }
45884591
.lightest-yellow { color: #fff3bf; }
45894592
.washed-yellow { color: #fffae4; }
45904593
.bg-yellow { background-color: #FBC335; }
@@ -6326,7 +6329,7 @@ code, .code, pre {
63266329
.ttl { text-transform: lowercase; }
63276330
.ttu { text-transform: uppercase; }
63286331
.ttn { text-transform: none; }
6329-
/*
6332+
/*
63306333
@media (--breakpoint-not-small) {
63316334
.ttc-ns { text-transform: capitalize; }
63326335
.ttl-ns { text-transform: lowercase; }
@@ -7063,4 +7066,4 @@ kbd {
70637066
line-height: 1;
70647067
padding: 2px 6px;
70657068
white-space: nowrap;
7066-
}
7069+
}

0 commit comments

Comments
 (0)