Skip to content

Commit

Permalink
Merge branch 'stage' into 'master'
Browse files Browse the repository at this point in the history
Stage

See merge request cometa/cometa!599
  • Loading branch information
anandkushwaha064 committed Nov 13, 2024
2 parents fe7aaea + fbc11d3 commit 4d0fbb5
Show file tree
Hide file tree
Showing 16 changed files with 458 additions and 174 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,22 @@ Here is what you need to be able to run Cometa.
Co.Meta needs to be able to fetch software from the internet. For example python libraries, pre-built containers with virtual browser.

When installing Co.meta in a corporate environment, make sure to whitelist the following domains on the Secure Proxy:

* **List of FQDNs (Full Qualified Domain Names) to clear proxy**
| **Domain** | **Reason** |
|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| git.amvara.de | Configure GitLab-runner to provide updates to Cometa. The server should have access to the Amvara GitLab. |
| d.amvara.de | Set up Discord notifications for monitoring Cometa servers (storage, errors, feature executions, etc.) and sending notifications to the Amvara team. |
| github.com <br> raw.githubusercontent.com <br> media.githubusercontent.com <br> avatars.githubusercontent.com <br> gist.githubusercontent.com | Cometa downloads dependencies from GitHub repositories, as it is built on open-source libraries. |
| docs.docker.com <br> download.docker.com <br> store.docker.com | These URLs are used to download and update Docker and Docker Compose installers when updates are required. |
| hub.docker.com | Cometa runs on Docker containers and downloads necessary images from Docker Hub, such as Python, Apache, Node.js, etc. |
| registry.npmjs.org <br> www.npmjs.com <br> deb.nodesource.com | Cometa runs a container called `cometa_socket`, which uses Node.js and npm. |
| repo.maven.apache.org | Cometa runs a container called `cometa_selenoid`, which downloads JAR libraries from Maven. |
| pypi.org | The Cometa components `cometa_behave`, `cometa_django`, and `cometa_scheduler` rely on Python libraries and download dependencies from this URL. |
| kubernetes-charts.storage.googleapis.com | Proxy clearance for accessing Kubernetes charts. |
| deb.debian.org <br> security.debian.org (http and https) | Most of the containers running within cometa uses debian based container, so Debian official repositories are needed for downloading and updating dependencies. |
| deb-multimedia.org (http and https) | Debian multimedia repository for additional multimedia-related packages. |

* https://*.amvara.de
* https://github.com
* https://*.githubusercontent.com
* https://*.docker.com
* https://*.docker.io
* https://registry.npmjs.org
* https://www.npmjs.com
* https://repo.maven.apache.org
* https://kubernetes-charts.storage.googleapis.com
* https://plugins.gradle.org:443
* https://registry.yarnpkg.com
* https://deb.nodesource.com
* https://mod-auth-openidc.org
* https://pypi.org
* http://*.debian.org and https://*.debian.org
<br><p>

For corporate environments using a Secure Proxy the Proxy usage needs to be configured:
Expand Down
45 changes: 41 additions & 4 deletions backend/src/backend/generatePDF.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,54 @@ def get(self, request):
response['Content-Length'] = len(PDFContent)
return response
else:
self.send_mail()

# Finish
return HttpResponse("200")

"""
This function handles the logic of sending the mail
"""
def send_mail(self):
feature = Feature.objects.get(feature_id=self.feature_id)
should_send_the_email = True

# if feature is set to check for notification on error
if feature.check_maximum_notification_on_error:
logger.debug("Checking for maximum emails on error")
# Check if current feature_result is failed
# Check if number of sent notifications are less then maximum number set to send the notification
if self.feature_result.success and not feature.send_mail_on_error:
should_send_the_email = True
feature.number_notification_sent = 0

elif self.feature_result.success:
should_send_the_email = False
feature.number_notification_sent = 0

# Send email and increase number_notification_sent count by 1
elif feature.number_notification_sent < feature.maximum_notification_on_error:
feature.number_notification_sent = feature.number_notification_sent + 1
should_send_the_email = True

elif feature.number_notification_sent >= feature.maximum_notification_on_error:
should_send_the_email = False
# In check_maximum_notification_on_error set number_notification_sent to 0 so that user can get the notification when new error is there
else:
feature.number_notification_sent = 0

feature.save()

if should_send_the_email:
# Build the subject and the emailbody.
self.subject = self.BuildEmailSubject()
self.emailbody = self.BuildEmailBody()

# Send the email.
self.SendEmail()


# Finish
return HttpResponse("200")

else:
logger.info("Skip sending email ")
"""
This function starts a logger to output information into syslog. It uses python default logger object.
"""
Expand Down
4 changes: 4 additions & 0 deletions backend/src/backend/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from django.dispatch import receiver
from django_cryptography.fields import encrypt
from crontab import CronSlices
from django.core.validators import MinValueValidator, MaxValueValidator

# GLOBAL VARIABLES

Expand Down Expand Up @@ -778,6 +779,9 @@ class Feature(models.Model):
created_by = models.ForeignKey(OIDCAccount, on_delete=models.SET_NULL, null=True, default=None, related_name="created_by")
send_mail = models.BooleanField(default=False)
send_mail_on_error = models.BooleanField(default=False)
check_maximum_notification_on_error = models.BooleanField(default=False)
maximum_notification_on_error = models.IntegerField(default=0,validators=[MinValueValidator(0)])
number_notification_sent = models.IntegerField(default=0,validators=[MinValueValidator(0)])
attach_pdf_report_to_email = models.BooleanField(verbose_name="Enable or disable the option to attach PDFs to emails.", help_text="If true, a test result PDF will be attached to the email; otherwise, the email will be sent without the PDF. This is useful when sending emails with a customized template.", default=True)
do_not_use_default_template = models.BooleanField(verbose_name="Do not use Default e-Mail Template", help_text="If true, then the alternative template will be used, which can be used for creating customized e-Mails, e.g. only containing screenshot", default=False)
email_address = ArrayField(models.CharField(max_length=250), null=True, blank=True, default=list)
Expand Down
39 changes: 39 additions & 0 deletions front/src/app/components/welcome/welcome.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,45 @@ <h1>
</ng-template>
</p>
</div>
<!-- Header -->
<div class="whats-new-title">
<div class="title">What's New</div>
<div class="date" *ngIf="date">{{ date }}</div>
</div>
<!-- Content -->
<div class="what-new-content">
<!-- <img class="poster" [src]="poster" /> -->
<div class="body">
<!-- New Features -->
<ng-container *ngIf="features.length > 0">
<div class="header">
<div class="title"> NEW FEATURES </div>
<div class="bar"></div>
</div>
<ul>
<li *ngFor="let feature of features">
<strong [innerHTML]="feature.title"></strong>:&nbsp;
<span [innerHTML]="feature.text">{{ feature.text }}</span>
</li>
</ul>
</ng-container>

<ng-container *ngIf="bugfixes.length > 0">
<div class="header">
<div class="title"> BUG FIXES </div>
<div class="bar"></div>
</div>
<ul>
<li *ngFor="let bugfix of bugfixes">
<span [innerHTML]="bugfix.text">{{ bugfix.text }}</span>
</li>
</ul>
</ng-container>
</div>
</div>
<div class="whats-new-title">
<div class="title">Explore More</div>
</div>
<!-- Upper row of buttons with everything related to help -->
<div class="welcome_buttons">
<div class="welcome_container">
Expand Down
Loading

0 comments on commit 4d0fbb5

Please sign in to comment.