-
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.
Merge branch 'main' of https://github.com/microsoft/intelligence-toolkit
- Loading branch information
Showing
30 changed files
with
336 additions
and
89 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
python-version: "3.10" | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.python-version }} | ||
|
||
- name: Install Dependencies | ||
run: pip install -r requirements.txt | ||
|
||
- name: Build Docker Image | ||
run: docker build . -t intel-toolkit:latest |
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,74 @@ | ||
name: Intelligence Toolkit | ||
pool: | ||
vmImage: ubuntu-latest | ||
|
||
trigger: | ||
batch: true | ||
branches: | ||
include: | ||
- main | ||
|
||
variables: | ||
isMain: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')] | ||
|
||
stages: | ||
- stage: Compliance | ||
dependsOn: [] | ||
jobs: | ||
- job: compliance | ||
displayName: Compliance | ||
pool: | ||
vmImage: windows-latest | ||
steps: | ||
- task: CredScan@3 | ||
inputs: | ||
outputFormat: sarif | ||
debugMode: false | ||
|
||
- task: ComponentGovernanceComponentDetection@0 | ||
inputs: | ||
scanType: "Register" | ||
verbosity: "Verbose" | ||
alertWarningLevel: "High" | ||
|
||
- task: PublishSecurityAnalysisLogs@3 | ||
inputs: | ||
ArtifactName: "CodeAnalysisLogs" | ||
ArtifactType: "Container" | ||
|
||
- stage: Build_deploy | ||
dependsOn: [] | ||
condition: eq(variables.isMain, 'true') | ||
jobs: | ||
- job: build | ||
displayName: Build | ||
pool: | ||
vmImage: ubuntu-latest | ||
steps: | ||
- task: UsePythonVersion@0 | ||
inputs: | ||
versionSpec: "3.10" | ||
displayName: "Use Python 3.10" | ||
- task: Bash@3 | ||
displayName: Install Dependencies | ||
inputs: | ||
workingDirectory: ./ | ||
targetType: "inline" | ||
script: pip install -r requirements.txt | ||
- task: Bash@3 | ||
displayName: Build Docker Image | ||
inputs: | ||
workingDirectory: ./ | ||
targetType: "inline" | ||
script: docker build . -t $(DOCKER_REGISTRY)/intel-toolkit:latest | ||
- task: Bash@3 | ||
displayName: Docker Login | ||
inputs: | ||
targetType: "inline" | ||
script: docker login -u $(DOCKER_USERNAME) -p $(DOCKER_PASSWORD) $(DOCKER_REGISTRY) | ||
- task: Bash@3 | ||
displayName: Push Docker Image | ||
inputs: | ||
workingDirectory: ./ | ||
targetType: "inline" | ||
script: docker push $(DOCKER_REGISTRY)/intel-toolkit:latest |
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
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,25 +1,23 @@ | ||
# TODO: The maintainer of this repo has not yet edited this file | ||
# Support | ||
|
||
**REPO OWNER**: Do you want Customer Service & Support (CSS) support for this product/project? | ||
## How to file issues and get help | ||
|
||
- **No CSS support:** Fill out this template with information about how to file issues and get help. | ||
- **Yes CSS support:** Fill out an intake form at [aka.ms/onboardsupport](https://aka.ms/onboardsupport). CSS will work with/help you to determine next steps. | ||
- **Not sure?** Fill out an intake as though the answer were "Yes". CSS will help you decide. | ||
This project uses GitHub Issues to track bugs and feature requests. Please search the existing | ||
issues before filing new issues to avoid duplicates. For new issues, file your bug or | ||
feature request as a new Issue. | ||
|
||
*Then remove this first heading from this SUPPORT.MD file before publishing your repo.* | ||
For help and questions about using this project, please create a GitHub issue with your question. | ||
|
||
# Support | ||
|
||
## How to file issues and get help | ||
## How to file issues and get help | ||
|
||
This project uses GitHub Issues to track bugs and feature requests. Please search the existing | ||
issues before filing new issues to avoid duplicates. For new issues, file your bug or | ||
This project uses GitHub Issues to track bugs and feature requests. Please search the existing | ||
issues before filing new issues to avoid duplicates. For new issues, file your bug or | ||
feature request as a new Issue. | ||
|
||
For help and questions about using this project, please **REPO MAINTAINER: INSERT INSTRUCTIONS HERE | ||
FOR HOW TO ENGAGE REPO OWNERS OR COMMUNITY FOR HELP. COULD BE A STACK OVERFLOW TAG OR OTHER | ||
CHANNEL. WHERE WILL YOU HELP PEOPLE?**. | ||
For help and questions about using this project, please file an issue on the repo. | ||
|
||
## Microsoft Support Policy | ||
## Microsoft Support Policy | ||
|
||
Support for this **PROJECT or PRODUCT** is limited to the resources listed above. | ||
Support for this project is limited to the resources listed above. |
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
File renamed without changes.
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,13 @@ | ||
# Copyright (c) 2024 Microsoft Corporation. All rights reserved. | ||
from javascript.styles import add_styles | ||
import components.app_user as au | ||
import streamlit as st | ||
|
||
def load_multipage_app(): | ||
#Load user if logged in | ||
user = au.app_user() | ||
user.view_get_info() | ||
|
||
#load css | ||
add_styles() | ||
|
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,41 @@ | ||
# Copyright (c) 2024 Microsoft Corporation. All rights reserved. | ||
import streamlit as st | ||
from javascript.scripts import get_auth_user | ||
from util.session_variables import SessionVariables | ||
|
||
class app_user: | ||
|
||
sv = None | ||
|
||
def __init__(self, sv = None): | ||
if sv is not None: | ||
self.sv = sv | ||
else: | ||
self.sv = SessionVariables('home') | ||
self.login() | ||
|
||
def _get_info(self): | ||
return self.sv.username.value | ||
|
||
def _set_user(self, username): | ||
self.sv.username.value = username | ||
|
||
def view_get_info(self): | ||
if self.sv.username.value: | ||
st.sidebar.write(f"Logged in as {self.sv.username.value}") | ||
|
||
def _view_error_info(self, return_value): | ||
st.warning(f"Could not directly read username from azure active directory: {return_value}.") | ||
|
||
def login(self): | ||
if self.sv.mode.value != 'cloud': | ||
return | ||
return_value = get_auth_user() | ||
username = None | ||
if return_value == 0: | ||
pass # this is the result before the actual value is returned | ||
elif isinstance(return_value, list) and len(return_value) > 0: | ||
username = return_value[0]["user_id"] | ||
self._set_user(username) | ||
else: | ||
self._view_error_info(return_value) |
File renamed without changes.
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,9 @@ | ||
# Copyright (c) 2024 Microsoft Corporation. All rights reserved. | ||
from streamlit_javascript import st_javascript | ||
import streamlit as st | ||
|
||
def get_auth_user(): | ||
js_code = """await fetch("/.auth/me") | ||
.then(function(response) {return response.json();}) | ||
""" | ||
return st_javascript(js_code) |
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,25 @@ | ||
# Copyright (c) 2024 Microsoft Corporation. All rights reserved. | ||
import streamlit as st | ||
|
||
style_sidebar = ''' | ||
[data-testid="stSidebarNavItems"] { | ||
max-height: 100vh | ||
} | ||
''' | ||
|
||
style_pdf = '''body { | ||
font-family: 'helvetica'; | ||
} | ||
''' | ||
|
||
style_iframes = ''' | ||
iframe { | ||
display: none; | ||
} | ||
''' | ||
|
||
def add_styles(): | ||
st.markdown(f'''<style> | ||
{style_sidebar} | ||
{style_iframes} | ||
</style>''', unsafe_allow_html=True) |
Oops, something went wrong.