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

purl-sync project #1209

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a11a924
Add test for person inbox and outbox
ziadhany Sep 11, 2023
b29c117
Stop all github actions
ziadhany Sep 11, 2023
bb08331
Add a server to server follow request
ziadhany Sep 11, 2023
ffff90e
Add a search function to Purl list , Git list , Review List.
ziadhany Sep 16, 2023
edecb41
Fix model Test
ziadhany Sep 16, 2023
46c38bc
Mock the follow request using side_effects
ziadhany Sep 16, 2023
2e180bb
Add a subscribe function
ziadhany Sep 18, 2023
9de00f0
Fix test server to server follow activity
ziadhany Sep 22, 2023
681c35e
Change the color of purl note content
ziadhany Sep 24, 2023
68cb411
Add a csrf_exempt to api auth
ziadhany Sep 25, 2023
b9fc25e
Fix a bug in get user inbox
ziadhany Sep 26, 2023
7509b47
Fix test get user inbox
ziadhany Oct 1, 2023
1bbe564
Add edit function to Person profile
ziadhany Oct 10, 2023
8bc9a71
Rename Purl List to packages
ziadhany Oct 13, 2023
9503984
Add a sync activity to view
ziadhany Oct 14, 2023
f04cabe
Add pictogram-gh-pages icon
ziadhany Oct 17, 2023
dc777dc
Change the name of the go to golang icon
ziadhany Oct 27, 2023
0b86203
Add pagination to home page
ziadhany Oct 27, 2023
5f41ba6
Add some docs to the model
ziadhany Oct 27, 2023
8717399
Update URL to pictograms
pombredanne Oct 27, 2023
0a2ae02
Add the license header to the project files
ziadhany Oct 28, 2023
cf9a99c
Create two purl-sync service port ( 8000,80001 ) using docker-compose
ziadhany Nov 3, 2023
47bb7f5
Fix federation of Follow request
ziadhany Nov 14, 2023
4408495
Fix federation of Importer
ziadhany Nov 20, 2023
af3a7d0
Fix Sync bug
ziadhany Nov 20, 2023
be20379
Refactor Importer code
ziadhany Dec 5, 2023
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
36 changes: 0 additions & 36 deletions .github/workflows/docs.yml

This file was deleted.

58 changes: 0 additions & 58 deletions .github/workflows/main.yml

This file was deleted.

83 changes: 0 additions & 83 deletions .github/workflows/pypi-release.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/test-import-using-nix.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/upstream_test.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,4 @@ Pipfile
*.bak
/.cache/
/tmp/
/purl_sync/venv_purl/
23 changes: 23 additions & 0 deletions purl_sync/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# VulnerableCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/vulnerablecode for support or download.
# See https://aboutcode.org for more information about nexB OSS projects.
#
FROM python:3.10
# Python settings: Force unbuffered stdout and stderr (i.e. they are flushed to terminal immediately)
ENV PYTHONUNBUFFERED 1
# Python settings: do not write pyc files
ENV PYTHONDONTWRITEBYTECODE 1

RUN pip install --upgrade pip

WORKDIR /purl_sync

COPY requirements.txt pyproject.toml /purl_sync/

RUN pip install -r requirements.txt

COPY . /purl_sync
97 changes: 97 additions & 0 deletions purl_sync/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# SPDX-License-Identifier: Apache-2.0
#
# http://nexb.com and https://github.com/nexB/scancode.io
# The ScanCode.io software is licensed under the Apache License version 2.0.
# Data generated with ScanCode.io is provided as-is without warranties.
# ScanCode is a trademark of nexB Inc.
#
# You may not use this software except in compliance with the License.
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software distributed
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
#
# Data Generated with ScanCode.io is provided on an "AS IS" BASIS, WITHOUT WARRANTIES
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
# ScanCode.io should be considered or used as legal advice. Consult an Attorney
# for any legal advice.
#
# ScanCode.io is a free software code scanning tool from nexB Inc. and others.
# Visit https://github.com/nexB/scancode.io for support and download.
# Modified for VulnerableCode use

# Python version can be specified with `$ PYTHON_EXE=python3.x make conf`
PYTHON_EXE?=python3
VENV=venv
MANAGE=${VENV}/bin/python manage.py
ACTIVATE?=. ${VENV}/bin/activate;
VIRTUALENV_PYZ=etc/thirdparty/virtualenv.pyz
# Do not depend on Python to generate the SECRET_KEY
GET_SECRET_KEY=`base64 /dev/urandom | head -c50`
# Customize with `$ make envfile ENV_FILE=/etc/vulnerablecode/.env`
ENV_FILE=.env
# Customize with `$ make postgres VULNERABLECODE_DB_PASSWORD=YOUR_PASSWORD`
VULNERABLECODE_DB_PASSWORD=vulnerablecode

virtualenv:
@echo "-> Bootstrap the virtualenv with PYTHON_EXE=${PYTHON_EXE}"
@${PYTHON_EXE} ${VIRTUALENV_PYZ} --never-download --no-periodic-update ${VENV}

conf: virtualenv
@echo "-> Install dependencies"
@${ACTIVATE} pip install -e . -c requirements.txt

dev: virtualenv
@echo "-> Configure and install development dependencies"
@${ACTIVATE} pip install -e .[dev] -c requirements.txt

envfile:
@echo "-> Create the .env file and generate a secret key"
@if test -f ${ENV_FILE}; then echo ".env file exists already"; exit 1; fi
@mkdir -p $(shell dirname ${ENV_FILE}) && touch ${ENV_FILE}
@echo SECRET_KEY=\"${GET_SECRET_KEY}\" > ${ENV_FILE}

isort:
@echo "-> Apply isort changes to ensure proper imports ordering"
${VENV}/bin/isort .

black:
@echo "-> Apply black code formatter"
${VENV}/bin/black .

valid: isort black

check:
@echo "-> Run pycodestyle (PEP8) validation"
@${ACTIVATE} pycodestyle --max-line-length=100 --exclude=venv,lib,thirdparty,docs,migrations,settings.py .
@echo "-> Run isort imports ordering validation"
@${ACTIVATE} isort --check-only .
@echo "-> Run black validation"
@${ACTIVATE} black --check ${BLACK_ARGS}

clean:
@echo "-> Clean the Python env"
rm -rf ${VENV} build/ dist/ vulnerablecode.egg-info/ docs/_build/ pip-selfcheck.json
find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete

migrate:
@echo "-> Apply database migrations"
${MANAGE} migrate

sqlite:
@echo "-> Configure SQLite database"
@echo VULNERABLECODE_DB_ENGINE=\"django.db.backends.sqlite3\" >> ${ENV_FILE}
@echo VULNERABLECODE_DB_NAME=\"sqlite3.db\" >> ${ENV_FILE}
@$(MAKE) migrate

run:
${MANAGE} runserver 8000 --insecure

test:
@echo "-> Run the test suite"
${ACTIVATE} ${PYTHON_EXE} -m pytest -vvs -m "not webtest"

webtest:
@echo "-> Run web tests"
${ACTIVATE} ${PYTHON_EXE} -m pytest -vvs -m "webtest"
9 changes: 9 additions & 0 deletions purl_sync/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# How to export VCIO and import in Purl-Sync

## How to export
1. VCIO run exporter command and save the data in a git repo like https://github.com/nexB/vulnerablecode-data

## How to import/sync:
1. Service Actor ( Activitypub admin ) Create a new git Repository instance
2. Service Actor Send a Sync-Activity
3. the Activitypub server pull all git repo data and run import command
Loading