I have configured github Action for automate the app deployment. What i am trying now is to get the email notification on action failure using AWS SES. I have used the send mail feature as given in the link.
1. https://github.com/marketplace/actions/send-email
Here is my code
- name: Send mail
if: always()
uses: dawidd6/action-send-mail#v3
with:
# mail server settings
server_address: ${{secrets.SMTP_HOST}}
server_port: 465
# Optional (recommended): mail server username:
username: ${{secrets.SMTP_USERNAME}}
# Optional (recommended) mail server password:
password: ${{secrets.SMTP_PASSWORD}}
# email subject
subject: ${{ github.job }} job of ${{ github.repository }} has ${{ job.status }}
# email body as text
body: ${{ github.job }} job in worflow ${{ github.workflow }} of ${{ github.repository }} has ${{ job.status }}
# comma-separated string, send email to
to: xyz#example.com
# from email name
from: 'abc#example.com'
Note:
my domain example.com is already verified in SES
my to and from addresses are alreay verified in SES
I am not in sandbox mode
Error I am getting
with:
server_address: ***
server_port: 465
username: ***
password: ***
subject: job1 job of ***/pv-core has success
body: job1 job in worflow TestCI of ***/pv-core has success
to: xyz#***.com
from: *** "abc#***.com"
Error: Mail command failed: 501 Invalid MAIL FROM address provided
Expectd output
Need to get alert to xyz#example.com (its alias email which will send to team of 5 members)
whenever the action fails
https://github.com/dawidd6/action-send-mail/pull/38#issuecomment-923132798
If you check the PR the owner mentioned it is out of scope.
Related
I am trying to build docker image and upload it to AWS ECR using Github actions. Had referred articles online and came up with an action file with one of its step as:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials#v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-to-assume: ${{ secrets.ROLE }}
aws-region: us-west-2
When I run the workflow, I get an error at this step saying "Error: The security token included in the request is invalid." even though I have provided the correct credentials. What am I missing here?
I wanted to get it connected and move to the next step, which is:
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login#v1
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: test
IMAGE_TAG: test_new
Any help would be appreciated.
We have multiple AWS accounts and network access is configured between two AWS accounts and service discovery is working with node-exporter. I have Prometheus configuration with some of the rules configured for the docker containers and now I have added one of the rules similar to the existing one to check if by mistakenly same container is launched in another AWS account and below is the rule. for exiting rules, {{ $labels.instance }} is printing in Alerts email, but not for the new rule which I have written newly
Scrape config for labels:
- job_name: 'aws-conatiners'
scheme: http
ec2_sd_configs:
- region: {{region}}
port: 8181
relabel_configs:
- source_labels: [__meta_ec2_tag_Name]
target_label: instance
The new rule which I have created to check if more than one container is running:
# Alert to check if more than one instance is running for backendapi service
- alert: multiple_instances_are_running
expr: sum(container_last_seen{name=~"backendapi"}) > 1
for: 5m
labels:
severity: critical
annotations:
summary: "More than one Instance (instance {{ $labels.instance }}) is running"
description: "More than one Instance (instance {{ $labels.instance }}) is running for 5 minutes."
Can someone please check and help me to get the instance name printed in alert emails
I am trying to build a docker image and pushing it to gcp artifactory. But it is failing in the github actions. Here is my workflow yaml file:
on:
push:
branches:
- main
- featurev1
name: Build and Deploy to Cloud Run
env:
REGION: 'europe-west1'
PROJECT_ID: 'myproject'
CLUSTER_NAME: 'myproject-cluster'
LOCATION: 'europe-west1'
ZONE: 'europe-west1'
ARTIFACT_REGISTRY: 'myproject-cust-seg'
TARGET_ENV: 'INT'
NAMESPACE: 'integration'
jobs:
deploy:
runs-on: [ self-hosted ]
# Add "id-token" with the intended permissions.
#permissions:
# contents: 'read'
# id-token: 'write'
steps:
- name: Checkout
uses: actions/checkout#v2
- name: Setup gcloud environment
uses: google-github-actions/setup-gcloud#v0
with:
service_account_key: ${{ secrets.INT_PLATFORM_SERVICE_ACCOUNT_KEY }}
project_id: ${{ env.PROJECT_ID }}
# Alternative option - authentication via credentials json
#- id: 'auth'
# uses: 'google-github-actions/auth#v0'
# with:
# credentials_json: ${{ secrets.INT_PLATFORM_SERVICE_ACCOUNT_KEY }}
- name: Authorize Docker push
run: gcloud auth configure-docker
- name: Build and Push Container
env:
GIT_TAG: ${{ github.run_id }}
run: |-
docker build -t $LOCATION-docker.pkg.dev/$PROJECT_ID/$ARTIFACT_REGISTRY/custapi:$TARGET_ENV-v$GIT_TAG .
docker push $LOCATION-docker.pkg.dev/$PROJECT_ID/$ARTIFACT_REGISTRY/custapi:$TARGET_ENV-v$GIT_TAG
But I have an error:
Run google-github-actions/setup-gcloud#v0
Error: google-github-actions/setup-gcloud failed with: failed to execute command gcloud --quiet config set project myproject: WARNING: Could not setup log file in /home/master/.config/gcloud/logs, (Could not create directory [/home/master/.config/gcloud/logs/2022.02.10]: Permission denied.
Please verify that you have permissions to write to the parent directory..
The configuration directory may not be writable. To learn more, see https://cloud.google.com/sdk/docs/configurations#creating_a_configuration
ERROR: (gcloud.config.set) Failed to create the default configuration. Ensure your have the correct permissions on: [/home/master/.config/gcloud/configurations].
Could not create directory [/home/master/.config/gcloud/configurations]: Permission denied.
Please verify that you have permission to write to the parent directory.
Right now I have used the service key json file as secret in GitHub actions as keyless authentication will be done in the near future, after the successful pilot of phase 1. So you could find the details above.
Here I have mentioned runs-on as "self-hosted" which is our onpremise github action runner.
I am trying to create a VM in GCP using ansible. I have followed the official tutorial on Ansible's website.
I created the service account and gave it 3 roles: compute.admin, editor and serviceAccountUser. Generated the JSON key and basically copy pasted the code
- name: create a address
gcp_compute_address:
name: 'test-adress'
region: "{{ region }}"
project: "{{ project }}"
auth_kind: "{{ auth_kind }}"
service_account_file: "{{ service_account_file }}"
scopes:
- https://www.googleapis.com/auth/compute
state: present
register: address
This is the output
fatal: [localhost]: FAILED! => {"changed": false, "msg": "GCP returned
error: {'error': {'code': 403, 'message': "Required
'compute.addresses.get' permission for
'projects/sdb20-21/regions/europe-west2/addresses/test-adress-lmao-lol'",
'errors': [{'message': "Required 'compute.addresses.get' permission
for
'projects/sdb20-21/regions/europe-west2/addresses/test-adress-lmao-lol'",
'domain': 'global', 'reason': 'forbidden'}]}}"}
I have tried pretty much every fix suggested in this website about this problem, to no avail. If I go to the google cloud "policy troubleshooter" it tells me that the service account does manage to call the api for "compute.addresses.get" with sucess.
The onty thing I cannot do is start another project, for school/credit reasons. Anything else is welcome
I am using redmine 2.5 version, last one week email notification are not working. It's worked before. Now getting error " An error occurred while sending mail (getaddrinfo: Temporary failure in name resolution) ".
This is my email configuration
email_delivery:
delivery_method: :smtp
smtp_settings:
address: smtp.rediffmail.com
port: 25
# ssl: true
# enable_starttls_auto: true
domain: rediffmail.com
authentication: :login
user_name: "XXXXXX#rediffmail.com"
password: "XXXX"
This is not a Redime problem, but a DNS problem. Check if you can send the mail to the problematic address from your standard email client.