-
Notifications
You must be signed in to change notification settings - Fork 4
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 github.com:expfactory/expfactory-deploy
- Loading branch information
Showing
10 changed files
with
131 additions
and
54 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 |
---|---|---|
|
@@ -21,18 +21,18 @@ jobs: | |
steps: | ||
|
||
- name: Checkout Code Repository | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
uses: actions/setup-python@v3.1.0 | ||
with: | ||
python-version: 3.8 | ||
|
||
# Run all pre-commit hooks on all the files. | ||
# Getting only staged files can be tricky in case a new PR is opened | ||
# since the action is run on a branch in detached head state | ||
- name: Install and Run Pre-commit | ||
uses: pre-commit/[email protected].0 | ||
uses: pre-commit/[email protected].3 | ||
|
||
# With no caching at all the entire ci process takes 4m 30s to complete! | ||
# pytest: | ||
|
@@ -41,7 +41,7 @@ jobs: | |
# steps: | ||
# | ||
# - name: Checkout Code Repository | ||
# uses: actions/checkout@v2 | ||
# uses: actions/checkout@v3 | ||
# | ||
# - name: Build the Stack | ||
# run: docker-compose -f local.yml build | ||
|
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
18 changes: 18 additions & 0 deletions
18
expfactory_deploy/experiments/migrations/0025_auto_20220331_1715.py
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,18 @@ | ||
# Generated by Django 3.1.7 on 2022-03-31 17:15 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('experiments', '0024_auto_20220330_1808'), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameField( | ||
model_name='repoorigin', | ||
old_name='origin', | ||
new_name='url', | ||
), | ||
] |
18 changes: 18 additions & 0 deletions
18
expfactory_deploy/experiments/migrations/0026_auto_20220331_1752.py
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,18 @@ | ||
# Generated by Django 3.1.7 on 2022-03-31 17:52 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('experiments', '0025_auto_20220331_1715'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='repoorigin', | ||
name='url', | ||
field=models.TextField(unique=True), | ||
), | ||
] |
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 |
---|---|---|
|
@@ -7,7 +7,9 @@ | |
from django.conf import settings | ||
from django.db import models | ||
from django.db.models import Q | ||
from django.dispatch import receiver | ||
from django.urls import reverse | ||
from giturlparse import parse | ||
from model_utils import Choices | ||
from model_utils.fields import MonitorField, StatusField | ||
from model_utils.models import StatusModel, TimeStampedModel | ||
|
@@ -48,12 +50,12 @@ class Meta: | |
class RepoOrigin(models.Model): | ||
""" Location of a repository that contains an experiment """ | ||
|
||
origin = models.URLField(unique=True) | ||
path = models.TextField() | ||
url = models.TextField(unique=True) | ||
path = models.TextField(unique=True) | ||
name = models.TextField(blank=True, unique=True) | ||
|
||
def __str__(self): | ||
return self.origin | ||
return self.url | ||
|
||
def get_latest_commit(self): | ||
return repo.get_latest_commit(self.path) | ||
|
@@ -87,6 +89,16 @@ def update_dependents(self): | |
battexp.experiment_instance = new_instance | ||
battexp.save() | ||
|
||
def clone(self): | ||
repo = git.Repo.clone_from(self.url, self.path) | ||
|
||
|
||
|
||
''' Will likely want to have clone be called as a task from here | ||
@receiver(models.signals.post_save, sender=RepoOrigin) | ||
def execute_after_save(sender, instance, created, *args, **kwargs): | ||
if created: | ||
''' | ||
|
||
@reversion.register() | ||
class ExperimentRepo(models.Model): | ||
|
@@ -113,11 +125,11 @@ def get_latest_commit(self): | |
def url(self): | ||
base_path = self.origin.path | ||
exp_location = self.location | ||
if "[email protected]:" in self.origin.origin: | ||
origin_url = self.origin.origin.replace("[email protected]:", "https://github.com/") | ||
if "[email protected]:" in self.origin.url: | ||
origin_url = self.origin.url.replace("[email protected]:", "https://github.com/") | ||
exp_location = self.location.replace(base_path, f"/tree/{self.branch}") | ||
else: | ||
origin_url = self.origin.origin | ||
origin_url = self.origin.url | ||
return f"{origin_url}{exp_location}" | ||
|
||
def __str__(self): | ||
|
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
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