-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andrei Stepanov <[email protected]> Co-authored-by: Chris Kelley <[email protected]>
- Loading branch information
1 parent
fe273e3
commit 0a2d30c
Showing
89 changed files
with
13,827 additions
and
27,040 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<EntitiesDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" Name="urn:keycloak"> | ||
<EntityDescriptor entityID="https://auth.redhat.com/auth/realms/EmployeeIDP"> | ||
<IDPSSODescriptor WantAuthnRequestsSigned="true" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol"> | ||
<KeyDescriptor use="signing"> | ||
<dsig:KeyInfo> | ||
<dsig:KeyName>APbMv27WYbGMYVaBNtILEQpnmprNUEuV76uCtODDZGs</dsig:KeyName> | ||
<dsig:X509Data> | ||
<dsig:X509Certificate>MIIE+jCCA+KgAwIBAgIED/4AJzANBgkqhkiG9w0BAQsFADBBMRAwDgYDVQQKDAdSZWQgSGF0MQ0wCwYDVQQLDARwcm9kMR4wHAYDVQQDDBVDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTcwNjIwMTI1MTQwWhcNMjIwNjE5MTI1MTQwWjCBqTELMAkGA1UEBhMCVVMxFzAVBgNVBAgMDk5vcnRoIENhcm9saW5hMR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AYIKwYBBQUHAwEGCCsGAQUFBwMCMA0GCSqGSIb3DQEBCwUAA4IBAQDBPTR0hAB/LTUWzi5jOG8Ni54gl6GDu/klaoOXjXzOUJY4keiNKKytyec9nEhUrUfuSMXGrteGnUc+8xq1WNmY9qHeaKHU2u8wsA8ekvmhSx550qZ1nocOumbswNKzSknTU9l1TH/GONgZwW99xxpbAmj6g7CjrsfQ2mESNkEzTT373eRUJriz/AgfxxgSyvBoxbNPx6IoekNUL8d/kHy1Jd7rOXbqBmYjeI7tMtidzezWDFAJkoQ05I3pDYvJfL999pYj/ykbqHg8Hkv/P+zLWSUuoI8ReIUCQDIO57+PTUMM9q7LwMX/viyym6jv2dKzDTGrB3AEYkRbBKxKng+u</dsig:X509Certificate> | ||
</dsig:X509Data> | ||
</dsig:KeyInfo> | ||
</KeyDescriptor> | ||
<SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://auth.redhat.com/auth/realms/EmployeeIDP/protocol/saml" /> | ||
<SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://auth.redhat.com/auth/realms/EmployeeIDP/protocol/saml" /> | ||
<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</NameIDFormat> | ||
<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat> | ||
<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</NameIDFormat> | ||
<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</NameIDFormat> | ||
<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://auth.redhat.com/auth/realms/EmployeeIDP/protocol/saml" /> | ||
<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://auth.redhat.com/auth/realms/EmployeeIDP/protocol/saml" /> | ||
<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP" Location="https://auth.redhat.com/auth/realms/EmployeeIDP/protocol/saml" /> | ||
</IDPSSODescriptor> | ||
</EntityDescriptor> | ||
</EntitiesDescriptor> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* This file is part of ciboard | ||
* Copyright (c) 2021, 2022, 2023 Andrei Stepanov <[email protected]> | ||
* Copyright (c) 2021, 2022, 2023, 2024 Andrei Stepanov <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
|
@@ -19,20 +19,22 @@ | |
*/ | ||
|
||
import _ from 'lodash'; | ||
import axios from 'axios'; | ||
import axios, { AxiosResponse } from 'axios'; | ||
import { ApolloClient } from '@apollo/client'; | ||
|
||
import { Artifact, getANvr, getAType } from '../types'; | ||
import { greenwave } from '../config'; | ||
import { GASetSearchOptionsPayload } from './types'; | ||
import { AppDispatch, GetState } from '../reduxStore'; | ||
import WaiverdbNewMutation from '../mutations/WaiverdbNew'; | ||
import * as alertsSlice from '../slices/alertsSlice'; | ||
import * as authSlice from '../slices/authSlice'; | ||
import * as filtersSlice from '../slices/filtersSlice'; | ||
import * as gatingTestsFormSlice from '../slices/gatingTestsFormSlice'; | ||
import * as waiveSlice from '../slices/waiveSlice'; | ||
import { Artifact, PayloadRPMBuildType } from '../artifact'; | ||
import { greenwave } from '../config'; | ||
import WaiverdbNewMutation from '../mutations/WaiverdbNew'; | ||
import { db_field_from_atype } from '../utils/artifactUtils'; | ||
import { AlertVariant } from '@patternfly/react-core'; | ||
import { CiTest } from '../components/PageDetails/types'; | ||
export * from '../slices/artifactsSlice'; | ||
export * from '../slices/artifactsQuerySlice'; | ||
|
||
export const cleanseGatingFormState = () => gatingTestsFormSlice.cleanse(); | ||
|
||
|
@@ -49,10 +51,10 @@ export const updateGatingSearchOptions = ( | |
gatingOptions: GASetSearchOptionsPayload, | ||
) => gatingTestsFormSlice.updateCriteria(gatingOptions); | ||
|
||
type AlertVariantType = 'success' | 'danger' | 'warning' | 'info' | 'default'; | ||
|
||
export const popAlert = (key: number) => alertsSlice.popAlert({ key }); | ||
|
||
type AlertVariantKeys = keyof typeof AlertVariant; | ||
|
||
/** | ||
* Push a new alert to the alerts queue. | ||
* @param variant Variant of the alert component, e.g. `success` or `warning`. | ||
|
@@ -61,7 +63,7 @@ export const popAlert = (key: number) => alertsSlice.popAlert({ key }); | |
* @returns Promise that resolves after a succesful event dispatch. | ||
*/ | ||
export const pushAlert = ( | ||
variant: AlertVariantType, | ||
variant: AlertVariantKeys, | ||
title: React.ReactNode, | ||
autoRm = true, | ||
) => { | ||
|
@@ -76,62 +78,22 @@ export const pushAlert = ( | |
}; | ||
}; | ||
|
||
export const addFilter = (newval = '', type = '') => { | ||
return async (dispatch: AppDispatch, getState: GetState) => { | ||
const { filters } = getState(); | ||
const currentType = filters.type; | ||
const activeFilters = filters.active; | ||
const foreignRegex = /[^\u0000-\u007f]/; | ||
if (foreignRegex.test(newval)) { | ||
console.log('Ignoring filter with no-latin character: %s', newval); | ||
return null; | ||
} | ||
console.log('%O', { newval, type }); | ||
if (!_.has(db_field_from_atype, type)) { | ||
console.log('Ignoring filter with unsupported type: %s', type); | ||
return null; | ||
} | ||
console.log('Add new filter', type, newval); | ||
if (type !== currentType) { | ||
/** new epoch */ | ||
} else if (_.includes(activeFilters, newval)) { | ||
console.log('Do not add existing filter', newval); | ||
return null; | ||
} | ||
dispatch(filtersSlice.addFilter({ newval, type })); | ||
}; | ||
}; | ||
|
||
export const deleteFilter = (delval = '') => | ||
filtersSlice.deleteFilter({ delval }); | ||
|
||
export const setOptionsForFilters = (newOptions: any) => { | ||
return async (dispatch: AppDispatch, getState: GetState) => { | ||
const { filters } = getState(); | ||
const currentOptions = filters.options; | ||
const optionsSame = _.isMatch(currentOptions, newOptions); | ||
if (optionsSame) { | ||
return null; | ||
} | ||
const type = filters.type; | ||
const activeFilters = filters.active; | ||
dispatch(filtersSlice.setOptions(newOptions)); | ||
for (const filter of activeFilters) { | ||
dispatch(addFilter(filter, type)); | ||
} | ||
}; | ||
}; | ||
|
||
export const fetchUser = () => { | ||
return async (dispatch: AppDispatch) => { | ||
const res = await axios.get('/current_user'); | ||
let res: AxiosResponse<any, any>; | ||
try { | ||
res = await axios.get('/current_user'); | ||
} catch (err) { | ||
console.log('Cannot get current user', err); | ||
return; | ||
} | ||
dispatch(authSlice.fetchUser(res.data)); | ||
}; | ||
}; | ||
|
||
export const createWaiver = ( | ||
artifact: Artifact | undefined, | ||
testcase: string | undefined, | ||
ciTest: CiTest | undefined, | ||
) => { | ||
return async (dispatch: AppDispatch, getState: GetState) => { | ||
const { displayName, nameID } = getState().auth; | ||
|
@@ -147,7 +109,7 @@ export const createWaiver = ( | |
); | ||
return; | ||
} | ||
dispatch(waiveSlice.createWaiver({ artifact, testcase })); | ||
dispatch(waiveSlice.createWaiver({ artifact, ciTest })); | ||
}; | ||
}; | ||
|
||
|
@@ -168,14 +130,19 @@ export const submitWaiver = (reason: string, client: ApolloClient<object>) => { | |
* get NVR, for modules we need to convert it to 'brew' like form | ||
*/ | ||
let waiveError: string; | ||
const { artifact, testcase } = getState().waive; | ||
if (_.isNil(_.get(artifact, 'payload.nvr')) || _.isNil(testcase)) { | ||
return; | ||
} | ||
const { artifact, ciTest } = getState().waive; | ||
const testcaseName = ciTest?.name; | ||
// NOTE: We know that artifact.payload is not null thanks to the check at the | ||
// top of the function. Moreover, we know that payload has the nvr property, | ||
// so we assert the type of the payload here. | ||
const nvr = (artifact!.payload! as PayloadRPMBuildType).nvr; | ||
const nvr = getANvr(artifact!); | ||
if (_.isNil(nvr) || _.isNil(testcaseName)) { | ||
const waiveError = `Cannot submit waiver for: ${nvr}, ${testcaseName}`; | ||
dispatch( | ||
waiveSlice.submitWaiver({ waiveError, reason: 'bad call' }), | ||
); | ||
return; | ||
} | ||
if (!nvr) { | ||
waiveError = 'Could not get NVR, please contact support.'; | ||
dispatch(waiveSlice.submitWaiver({ waiveError, reason: '' })); | ||
|
@@ -187,26 +154,23 @@ export const submitWaiver = (reason: string, client: ApolloClient<object>) => { | |
* NOTE: We know that artifact is not null thanks to the check at the top | ||
* of the function. | ||
*/ | ||
let artifactType = artifact!.type; | ||
if (artifactType === 'brew-build' && nvr.match(/.*-container-.*/)) { | ||
artifactType = 'redhat-container-image'; | ||
let aType = getAType(artifact!); | ||
if (aType === 'brew-build' && nvr.match(/.*-container-.*/)) { | ||
aType = 'redhat-container-image'; | ||
} | ||
const product_version = greenwave.decision.product_version( | ||
nvr, | ||
artifactType, | ||
); | ||
const product_version = greenwave.decision.product_version(nvr, aType); | ||
try { | ||
const response = await client.mutate({ | ||
mutation: WaiverdbNewMutation, | ||
variables: { | ||
// NOTE: We know that artifact is not null thanks to the check at | ||
// the top of the function. | ||
subject_type: artifact!.type, | ||
subject_identifier: nvr, | ||
testcase, | ||
waived: true, | ||
product_version, | ||
comment: reason, | ||
testcase: testcaseName, | ||
subject_type: aType, | ||
product_version, | ||
subject_identifier: nvr, | ||
}, | ||
}); | ||
console.log('Got response from WaiverDB', response); | ||
|
Oops, something went wrong.