Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Remove Python App Function Deployment Code and enable_dotnet Code. #2636

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
53 changes: 3 additions & 50 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,52 +255,6 @@ jobs:
service:
needs:
- onefuzztypes
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- run: src/ci/set-versions.sh
- uses: actions/setup-python@v4
with:
python-version: 3.8
- uses: actions/download-artifact@v3
with:
name: build-artifacts
path: artifacts
- name: Build Service
run: |
cd src/api-service/__app__
echo ${GITHUB_RUN_ID} | tee onefuzzlib/build.id
echo ${GITHUB_SHA} | tee onefuzzlib/git.version
python -m pip install --upgrade pip
pip install --target="./.python_packages/lib/site-packages" -r ./requirements.txt ${GITHUB_WORKSPACE}/artifacts/sdk/onefuzztypes-*.whl
zip -r api-service.zip .
mkdir -p ${GITHUB_WORKSPACE}/artifacts/service
cp api-service.zip ${GITHUB_WORKSPACE}/artifacts/service
- uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: artifacts
- name: lint
run: |
cd src/api-service
rm -rf __app__/.python_packages
python -m pip install --upgrade pip
pip install ${GITHUB_WORKSPACE}/artifacts/sdk/onefuzztypes-*.whl
pip install -r __app__/requirements.txt
pip install -r requirements-dev.txt
pytest tests
flake8 .
bandit -r ./__app__/
black ./__app__/ ./tests --check
isort --profile black ./__app__/ ./tests --check
mypy __app__ ./tests

# set a minimum confidence to ignore known false positives
vulture --min-confidence 61 __app__

../ci/disable-py-cache.sh
mypy __app__ ./tests
service-net:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -359,9 +313,9 @@ jobs:
cd src/ApiService/ApiService/
mv az-local.settings.json bin/Release/net7.0/local.settings.json
cd bin/Release/net7.0/
zip -r api-service-net.zip .
mkdir -p ${GITHUB_WORKSPACE}/artifacts/service-net
cp api-service-net.zip ${GITHUB_WORKSPACE}/artifacts/service-net
zip -r api-service.zip .
mkdir -p ${GITHUB_WORKSPACE}/artifacts/service
cp api-service.zip ${GITHUB_WORKSPACE}/artifacts/service
- uses: actions/upload-artifact@v3
with:
name: build-artifacts
Expand Down Expand Up @@ -504,7 +458,6 @@ jobs:

cp artifacts/proxy/onefuzz-proxy-manager src/deployment/tools/linux/
cp artifacts/service/api-service.zip src/deployment
cp artifacts/service-net/api-service-net.zip src/deployment
cp -r artifacts/third-party src/deployment
echo $GITHUB_RUN_ID | tee src/deployment/.build.id
echo $GITHUB_SHA | tee src/deployment/.sha
Expand Down
3 changes: 1 addition & 2 deletions src/ApiService/ApiService/onefuzzlib/Creds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ public Async.Task<Region> GetBaseRegion() {
}

public Uri GetInstanceUrl()
// TODO: remove -net when promoted to main version
=> new($"https://{GetInstanceName()}-net.azurewebsites.net");
=> new($"https://{GetInstanceName()}.azurewebsites.net");

public record ScaleSetIdentity(string principalId);

Expand Down
10 changes: 1 addition & 9 deletions src/api-service/__app__/onefuzzlib/azure/creds.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,9 @@ def get_instance_url() -> str:
return "https://%s.azurewebsites.net" % get_instance_name()


@cached
def use_dotnet_agent_functions() -> bool:
return os.environ.get("ONEFUZZ_USE_DOTNET_AGENT_FUNCTIONS") == "1"


@cached
def get_agent_instance_url() -> str:
if use_dotnet_agent_functions():
return "https://%s-net.azurewebsites.net" % get_instance_name()
else:
return get_instance_url()
return get_instance_url()


@cached
Expand Down
12 changes: 0 additions & 12 deletions src/cli/onefuzz/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1790,8 +1790,6 @@ def __setup__(
client_secret: Optional[str] = None,
authority: Optional[str] = None,
tenant_domain: Optional[str] = None,
_dotnet_endpoint: Optional[str] = None,
_dotnet_functions: Optional[List[str]] = None,
) -> None:

if endpoint:
Expand All @@ -1804,10 +1802,6 @@ def __setup__(
self._backend.client_secret = client_secret
if tenant_domain is not None:
self._backend.config.tenant_domain = tenant_domain
if _dotnet_endpoint is not None:
self._backend.config.dotnet_endpoint = _dotnet_endpoint
if _dotnet_functions is not None:
self._backend.config.dotnet_functions = _dotnet_functions

if self._backend.is_feature_enabled(PreviewFeature.job_templates.name):
self.job_templates._load_cache()
Expand Down Expand Up @@ -1851,8 +1845,6 @@ def config(
client_id: Optional[str] = None,
enable_feature: Optional[PreviewFeature] = None,
tenant_domain: Optional[str] = None,
_dotnet_endpoint: Optional[str] = None,
_dotnet_functions: Optional[List[str]] = None,
reset: Optional[bool] = None,
) -> BackendConfig:
"""Configure onefuzz CLI"""
Expand Down Expand Up @@ -1883,10 +1875,6 @@ def config(
self._backend.enable_feature(enable_feature.name)
if tenant_domain is not None:
self._backend.config.tenant_domain = tenant_domain
if _dotnet_endpoint is not None:
self._backend.config.dotnet_endpoint = _dotnet_endpoint
if _dotnet_functions is not None:
self._backend.config.dotnet_functions = _dotnet_functions
self._backend.app = None
self._backend.save_config()

Expand Down
7 changes: 1 addition & 6 deletions src/cli/onefuzz/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ class BackendConfig(BaseModel):
endpoint: Optional[str]
features: Set[str] = Field(default_factory=set)
tenant_domain: Optional[str]
dotnet_endpoint: Optional[str]
dotnet_functions: Optional[List[str]]


class Backend:
Expand Down Expand Up @@ -301,10 +299,7 @@ def request(
params: Optional[Any] = None,
_retry_on_auth_failure: bool = True,
) -> Response:
if self.config.dotnet_functions and path in self.config.dotnet_functions:
endpoint = self.config.dotnet_endpoint
else:
endpoint = self.config.endpoint
endpoint = self.config.endpoint

if not endpoint:
raise Exception("endpoint not configured")
Expand Down
1 change: 1 addition & 0 deletions src/deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ yanked = "deny"
ignore = [
"RUSTSEC-2022-0048", # xml-rs is unmaintained
"RUSTSEC-2021-0139", # ansi_term is unmaintained
"RUSTSEC-2021-0145", # waiting for clap upgrade; we are unaffected by the bug (no custom allocator)
]

[bans]
Expand Down
Loading