Merge branch 'dev' into assets-custom-headers

This commit is contained in:
Alexander 2022-06-30 16:47:49 +02:00 committed by GitHub
commit aef42c2d3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 38 deletions

View file

@ -91,7 +91,7 @@ jobs:
cat /tmp/image_override.yaml
# Deploy command
helm upgrade --install openreplay -n app openreplay -f vars.yaml -f /tmp/image_override.yaml --atomic --set skipMigration=true --no-hooks
helm template openreplay -n app openreplay -f vars.yaml -f /tmp/image_override.yaml --atomic --set skipMigration=true --no-hooks | kubectl apply -f -
env:
DOCKER_REPO: ${{ secrets.OSS_REGISTRY_URL }}
IMAGE_TAG: ${{ github.sha }}
@ -152,7 +152,7 @@ jobs:
cat /tmp/image_override.yaml
# Deploy command
helm upgrade --install openreplay -n app openreplay -f vars.yaml -f /tmp/image_override.yaml --set skipMigration=true --no-hooks
helm template openreplay -n app openreplay -f vars.yaml -f /tmp/image_override.yaml --set skipMigration=true --no-hooks | kubectl apply -f -
env:
DOCKER_REPO: ${{ secrets.EE_REGISTRY_URL }}
# We're not passing -ee flag, because helm will add that.

View file

@ -24,14 +24,7 @@ func main() {
cfg := config.New()
cacher := cacher.NewCacher(
cfg.AWSRegion,
cfg.S3BucketAssets,
cfg.AssetsOrigin,
cfg.AssetsSizeLimit,
cfg.AssetsRequestHeaders,
metrics,
)
cacher := cacher.NewCacher(cfg, metrics)
totalAssets, err := metrics.RegisterCounter("assets_total")
if err != nil {

View file

@ -17,6 +17,7 @@ import (
"github.com/pkg/errors"
config "openreplay/backend/internal/config/assets"
"openreplay/backend/pkg/storage"
"openreplay/backend/pkg/url/assets"
)
@ -34,15 +35,8 @@ type cacher struct {
requestHeaders map[string]string
}
func NewCacher(
region string,
bucket string,
origin string,
sizeLimit int,
requestHeaders map[string]string,
metrics *monitoring.Metrics,
) *cacher {
rewriter := assets.NewRewriter(origin)
func NewCacher(cfg *config.Config, metrics *monitoring.Metrics) *cacher {
rewriter := assets.NewRewriter(cfg.AssetsOrigin)
if metrics == nil {
log.Fatalf("metrics are empty")
}
@ -52,18 +46,19 @@ func NewCacher(
}
return &cacher{
timeoutMap: newTimeoutMap(),
s3: storage.NewS3(region, bucket),
s3: storage.NewS3(cfg.AWSRegion, cfg.S3BucketAssets),
httpClient: &http.Client{
Timeout: time.Duration(6) * time.Second,
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
},
},
rewriter: rewriter,
Errors: make(chan error),
sizeLimit: sizeLimit,
sizeLimit: cfg.AssetsSizeLimit,
downloadedAssets: downloadedAssets,
requestHeaders: requestHeaders,
requestHeaders: cfg.AssetsRequestHeaders,
}
}

View file

@ -3,6 +3,7 @@ package storage
import (
"io"
"net/url"
"os"
"sort"
"strconv"
@ -103,7 +104,7 @@ func (s3 *S3) GetFrequentlyUsedKeys(projectID uint64) ([]string, error) {
func loadFileTag() string {
// Load file tag from env
key := "retention"
value := env.String("RETENTION")
value := os.Getenv("RETENTION")
if value == "" {
value = "default"
}

View file

@ -14,7 +14,7 @@ const SelectedValue = ({ icon, text }) => {
</div>
)
}
class IssueForm extends React.PureComponent {
componentDidMount() {
const { projects, issueTypes } = this.props;
@ -37,7 +37,7 @@ class IssueForm extends React.PureComponent {
const { sessionId, addActivity } = this.props;
const { instance } = this.props;
addActivity(sessionId, instance).then(() => {
addActivity(sessionId, instance.toJS()).then(() => {
const { errors } = this.props;
if (!errors || errors.length === 0) {
this.props.init({projectId: instance.projectId});
@ -47,20 +47,23 @@ class IssueForm extends React.PureComponent {
});
}
write = ({ target: { name, value } }) => this.props.edit({ [ name ]: value });
writeOption = (e, { name, value }) => this.props.edit({ [ name ]: value });
write = (e) => {
const { target: { name, value } } = e;
this.props.edit({ [ name ]: value })
};
writeOption = ({ name, value }) => this.props.edit({ [ name ]: value });
render() {
const { creating, projects, users, issueTypes, instance, closeHandler, metaLoading } = this.props;
const projectOptions = projects.map(({name, id}) => ({text: name, value: id })).toArray();
const userOptions = users.map(({name, id}) => ({text: name, value: id })).toArray();
const projectOptions = projects.map(({name, id}) => ({label: name, value: id })).toArray();
const userOptions = users.map(({name, id}) => ({label: name, value: id })).toArray();
const issueTypeOptions = issueTypes.map(({name, id, iconUrl, color }) => {
return {text: name, value: id, iconUrl, color }
}).toArray();
const selectedIssueType = issueTypes.filter(issue => issue.id == instance.issueType).first();
return { label: name, value: id, iconUrl, color }
});
const selectedIssueType = issueTypes.filter(issue => issue.id == instance.issueType)[0];
return (
<Form onSubmit={ this.onSubmit }>
<Form.Field className="mb-15-imp">
@ -134,11 +137,16 @@ class IssueForm extends React.PureComponent {
variant="primary"
disabled={ !instance.validate() }
className="float-left mr-2"
>{'Create'}</Button>
type="submit"
>
{'Create'}
</Button>
<Button
type="button"
onClick={ closeHandler }
>{'Cancel'}</Button>
>
{'Cancel'}
</Button>
</Form>
);
}

View file

@ -48,7 +48,7 @@ const reducer = (state = initialState, action = {}) => {
case FETCH_ASSIGNMENT.SUCCESS:
return state.set('activeIssue', Assignment({ ...action.data, users}));
case FETCH_META.SUCCESS:
issueTypes = List(action.data.issueTypes).map(IssuesType);
issueTypes = action.data.issueTypes
var issueTypeIcons = {}
issueTypes.forEach(iss => {
issueTypeIcons[iss.id] = iss.iconUrl
@ -109,9 +109,10 @@ export function fetchAssigment(sessionId, id) {
}
export function addActivity(sessionId, params) {
const data = { ...params, assignee: params.assignee.value, issueType: params.issueType.value }
return {
types: ADD_ACTIVITY.toArray(),
call: client => client.post(`/sessions2/${ sessionId }/assign/projects/${params.projectId}`, params.toCreate()),
call: client => client.post(`/sessions2/${ sessionId }/assign/projects/${params.projectId.value}`, data),
}
}
@ -120,4 +121,4 @@ export function addMessage(sessionId, assignmentId, params) {
types: ADD_MESSAGE.toArray(),
call: client => client.post(`/sessions2/${ sessionId }/assign/${ assignmentId }/comment`, params),
}
}
}