Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/his internal profile #2887

Merged
merged 15 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions api-gateway/src/main/resources/application-internal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
gateway:
nulls marked this conversation as resolved.
Show resolved Hide resolved
backend:
url: http://localhost:5800
nulls marked this conversation as resolved.
Show resolved Hide resolved
frontend:
# In the "dev" environment, the front-end uses TCP port 8080 when run using `webpack-dev-server` (i.e. `browserDevelopmentRun` or `run` Gradle task).
url: http://localhost:8080
sandbox:
url: http://localhost:5400
demo:
url: http://localhost:5421
demo-cpg:
url: http://localhost:5500
spring:
security:
oauth2:
client:
provider:
codehub:
authorization-uri: https://codehub-g.huawei.com/oauth/authorize
token-uri: https://codehub-g.huawei.com/oauth/token
user-info-uri: https://codehub-g.huawei.com/api/v4/user
user-name-attribute: username
user-info-authentication-method: post
registration:
codehub:
provider: codehub
redirect-uri: '${gateway.frontend.url}/{action}/oauth2/code/{registrationId}'
authorization-grant-type: authorization_code
client-authentication-method: client_secret_post
# can be
# - openid (doesn't work due to invalid_nonce)
nulls marked this conversation as resolved.
Show resolved Hide resolved
# - email (works but user allowed to not select to share an email)
# - profile
scope: profile

logging:
level:
org.springframework.web: DEBUG
org.springframework.security: DEBUG
com.nimbusds: TRACE

---
spring:
error:
whitelabel:
enabled: false

server:
error:
path: /error
16 changes: 11 additions & 5 deletions save-cloud-charts/save-cloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ command line using `--set` flag.

## Local deployment
* Install minikube: https://minikube.sigs.k8s.io/docs/start/
* install csi addon in minikube to provide this StorageClass type in your minikube cluster
```bash
minikube addons enable csi-hostpath-driver
```
* [optional] modify kube config file to use base64 encripted info about certs and keys instead of using path to cert file
```yaml
certificate-authority-data: <base64 encoded cert>
client-certificate-data: <base64 encoded cert>
client-key-data: <base64 encoded cert>
```
* Environment should be prepared:
```bash
minikube ssh
Expand All @@ -60,13 +70,9 @@ command line using `--set` flag.
build.docker.tls-verify=true
build.docker.cert-path=<path-to-user-home>/.minikube/certs
```
* (Required only once) Install Helm chart using `values-minikube.yaml`:
```bash
$ helm install save-cloud save-cloud-0.1.0.tgz --namespace save-cloud --values values-minikube.yaml <any other value files and/or --set flags>
```
* (On consecutive deployments) Upgrade an existing Helm release:
```bash
$ helm upgrade save-cloud save-cloud-0.1.0.tgz --namespace save-cloud --values values-minikube.yaml <any other value files and/or --set flags>
$ helm --kube-context=minikube --namespace=save-cloud upgrade -i save-cloud save-cloud-0.1.0.tgz/<or use ulr oci://ghcr.io/saveourtool/save-cloud> --values values-minikube.yaml --values=values-images.yaml <any other value files and/or --set flags>
```
* Database migrations can be run by setting value `mysql.migrations.enabled` to `true` (no additional setup, migrations
are executed by init container, but may be too slow with constant recreations of backend/sandbox pods)
Expand Down
25 changes: 25 additions & 0 deletions save-cloud-charts/save-cloud/values-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
chartVersion: '0.2.1+1056'

# The version from the "Build and push Docker images" action.
#
# Search the log for the "Successfully built image
# 'ghcr.io/saveourtool/api-gateway:master'" line, or simply
# look up the version of the latest published package at
# <https://github.com/orgs/saveourtool/packages?repo_name=save-cloud>.
dockerTag: '0.4.0-alpha.0.379-70423bd'
gateway:
dockerTag: '0.4.0-alpha.0.379-70423bd'
backend:
dockerTag: '0.4.0-alpha.0.379-70423bd'
frontend:
dockerTag: '0.4.0-alpha.0.379-70423bd'
preprocessor:
dockerTag: '0.4.0-alpha.0.379-70423bd'
orchestrator:
dockerTag: '0.4.0-alpha.0.379-70423bd'
sandbox:
dockerTag: '0.4.0-alpha.0.379-70423bd'
demo:
dockerTag: '0.4.0-alpha.0.379-70423bd'
demo_cpg:
dockerTag: '0.4.0-alpha.0.379-70423bd'
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

package com.saveourtool.save.frontend.common.utils

import com.saveourtool.save.frontend.common.externals.fontawesome.*
import com.saveourtool.save.frontend.common.externals.fontawesome.faCopyright
import com.saveourtool.save.frontend.common.externals.fontawesome.faSignInAlt
import com.saveourtool.save.frontend.common.externals.fontawesome.fontAwesomeIcon
import com.saveourtool.save.info.OauthProviderInfo
Expand Down Expand Up @@ -43,7 +41,7 @@ fun ChildrenBuilder.processRegistrationId(
) = oauthLoginForKnownAwesomeIcons(
oauthProvidersFeConfig,
mapKnownUploadedIcons(oauthProvidersFeConfig.provider.registrationId),
mapKnownFontAwesomeIcons(oauthProvidersFeConfig.provider.registrationId)
faSignInAlt
)

/**
Expand Down Expand Up @@ -88,15 +86,6 @@ private fun ChildrenBuilder.oauthLoginForKnownAwesomeIcons(
}
}

/**
* @param registrationId oauth provider name (same as in spring security config) from api-gateway
*/
fun mapKnownFontAwesomeIcons(registrationId: String) =
when (registrationId) {
"codehub" -> faCopyright
else -> faSignInAlt
}

/**
* Mapping ONLY for those icons that are uploaded to SAVE.
* Please note that companies like google strictly prohibits incorrect usage of sign-in buttons:
Expand All @@ -110,5 +99,6 @@ fun mapKnownUploadedIcons(registrationId: String) =
"gitee" -> "/img/gitee.svg"
"github" -> "/img/github.svg"
"google" -> "/img/google.svg"
"codehub" -> "/img/codehub.svg"
nulls marked this conversation as resolved.
Show resolved Hide resolved
else -> ""
}
37 changes: 37 additions & 0 deletions save-frontend/src/main/resources/img/codehub.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading