I'm totally new to testing, CircleCI, and software engineering generally. I put in a big shift today to try and write a simple Cypress test, use CircleCI to run it every hour, and post to Slack whether it was successful.
The first two I've managed, but integration with Slack has proven more difficult than I imagined. I suspect it's because I'm getting the config.yml wrong. Here's the code.
version: 2.1
orbs:
node: circleci/node#4.5.1
cypress: cypress-io/cypress#1.28.0
slack: circleci/slack#4.4.2
jobs:
notify:
executor:
name: node/default
steps:
- slack/notify:
channel: general
event: fail
template: basic_fail_1
mentions: '#Jac'
- slack/notify:
channel: general
event: pass
template: success_tagged_deploy_1
mentions: '#Jac'
workflows:
version: 2
commit-workflow:
jobs:
- cypress/run:
record: true
store_artifacts: true
- notify:
context: slack-secrets
thirty-min-workflow:
triggers:
- schedule:
cron: "0,30 * * * *"
filters:
branches:
only:
- main
jobs:
- cypress/run
- notify:
context: slack-secrets
The tests are running fine, as scheduled, and a notification is pushing to Slack, but the notification triggers as soon as the build starts and is not dependent on the outcome of the tests.
I've racked my brain on this final point for hours, so I'm hoping it's an easy fix!
I managed to figure this out. Fairly simple in the end. I added a post-steps property beneath cypress/run, which will run after the tests. By placing slack/notify beneath post-steps, it successfully ran after my tests and reflected the result.
Here's the config.yml file.
version: 2.1
orbs:
node: circleci/node#4.5.1
cypress: cypress-io/cypress#1.28.0
slack: circleci/slack#4.4.2
workflows:
version: 2
commit-workflow:
jobs:
- cypress/run:
post-steps:
- slack/notify:
channel: general
event: fail
template: basic_fail_1
mentions: '#Jack'
You can also add a when attribute to the cypress job and check for on_success value, if the job is successful then trigger slack notify job - for more help - https://circleci.com/docs/2.0/configuration-reference/#the-when-attribute
Related
I deployed a Nuxt 3 website as a classic SPA since I don't need SSR for my project. Used nuxt generate and deployed the contents from .output/public/ in Azure static web app. It is successfully running now, but when I'm accessing pages with dynamic routes like user/[id] and hit refresh the page, I'm getting this message:
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
nuxt.config.ts
export default defineNuxtConfig({
ssr: false,
});
I'm just really new on Nuxt and in Vue world will appreciate any help guys.
I have followed the MSDoc and able to run the Nuxt JS app without any issues.
Make sure you have followed the same steps as below.
Navigate to the GitHub and create a new repository from nuxt-3-starter.
New repo with code will be generated.
In Azure Portal, create a new Static Web App.
Select the GitHub and provide the Repository and branch details as shown below.
We can also check the Workflow file.
My Workflow:
name: Azure Static Web Apps CI/CD
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main
jobs:
build_and_deploy_job:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- uses: actions/checkout#v2
with:
submodules: true
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy#v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_PLANT_0E617661E }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/" # App source code path
api_location: ".output/server"
output_location: ".output/public" # Built app content directory
###### End of Repository/Build Configurations ######
close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy#v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_PLANT_0E617661E }}
action: "close"
Make sure the build and deployment are successful. We can check it in GitHub Repository => Actions.
Click on the Workflow file, you can see the Jobs Status.
OutPut:
With dynamic routes - user/[id]
Please Check the code in my GitHub Repository.
I am having an issue running karate UI tests in the containers.
I am able to clearly run the tests in the local .But my test runs in container says "ERROR com.intuit.karate - driver config / start failed:"
I am using driver config as below
configure driver = { type: 'chrome', headless: true, showDriverLog: true, addOptions: ['--incognito'], httpConfig: { readTimeout: 120000 }}
I am not using any other configs.
Has anyone been in this situation
Containers are not easy and you seem to be trying some approach of your own (also headless). Please follow the Karate documentation and use the recommended Docker containers.
https://github.com/intuit/karate/tree/master/karate-core#karate-chrome
If still stuck kindly follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue - and help up improve / fix the framework (and provide more details).
I am using npm package https://www.npmjs.com/package/serverless-step-functions-offline for running step functions offline. However I get the output form serverless as
Function "SaveSlotDetails" does not presented in serverless.yml
I have follwed the steps exactly as per the documentation, but I am not able to run the step function locally
Below is my serverless.yml file content for the related context
custom:
stepFunctionsOffline:
SaveSlotDetails:CreateSubscription
functions: # add 4 functions for CRUD
createSubscription:
handler: handlers/subscriptions.create
name: CreateSubscription
events:
- http:
path: subscriptions # path will be domain.name.com/dev/subscriptions
method: post
cors: true
stepFunctions:
stateMachines:
SlotCheckingMachine:
name: ProcessSlotAvailabilityStateMachine
definition:
StartAt: SaveSlotDetails
TimeoutSeconds: 3600
States:
SaveSlotDetails:
Type: Task
Resource: "arn:aws:lambda:us-east-1:269266452438:function:CreateSlot"
Next: "SearchSubscriptions"
I have tried using both function names createSubscription and
CreateSubscription, but nothing helps. I checked issues previously
raised, but doesn't help much
I am tried using versions 2.1.2 and 2.1.1, but doesn't work. Any help would be appreciated
I have the following semver setup:
- name: version
type: semver
source:
driver: gcs
bucket: my-ci
json_key: ((my.serviceaccount))
key: version/version.txt
initial_version: 0.0.0
In my publishjob, I have the following:
name: publish
serial_groups: [version]
plan:
- get: version
passed: [build]
trigger: true
So, basically the publish job is triggered after build job is passed (version updated)
Now, in the publish job I am creating a docker image and pushing it to gcr.
- put: my-gcr
params:
additional_tags: my/ci/tags
build: mycode
get_params: {skip_download: true}
Here, the image is correctly tagged based on the values in the tags file. However, I want to set these values dynamically based on the current version which can be retreived following this:
https://concoursetutorial.com/miscellaneous/versions-and-buildnumbers/#display-version
How can I use this version number to tag my docker image?
I solved it using the following code:
- put: artifacts
params:
additional_tags: version/number
build: mycode
get_params: {skip_download: true}
I would like to display which build step(s ?) failed in our slack notification.
I couldn't find any reference here http://plugins.drone.io/drone-plugins/drone-slack/
maybe you could try using the when clause on failure condition
notify:
slack:
channel: foo
when:
success: false
failure: true
change: true
here is the complete reference and example on drone notification
drone notify