I tried to create CI/CD pipeline for Selenium maven project using CircleCI. but I found webDriverException. Here, I attached screenshot and circleCI.yml file. enter image description here
enter image description hereenter image description here
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/openjdk:11-jdk
working_directory: ~/demoProject
environment:
# Customize the JVM maximum heap limit
MAVEN_OPTS: -Xmx3200m
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "pom.xml" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: mvn dependency:go-offline
- run:
name: Running X virtual framebuffer
command: Xvfb :0 -ac &
- run:
name: Run Tests
command: |
export DISPLAY=:99
- save_cache:
paths:
- ~/.m2
key: v1-dependencies-{{ checksum "pom.xml" }}
# run tests!
- run: mvn clean test
- store_artifacts:
path: target/surefire-reports
destination: tr1
- store_test_results:
path: target/surefire-reports
Related
I have created this yam file to create a binary image for my iot board with circle ci..
version: 2.1
orbs:
python: circleci/python#1.4.0
jobs:
build:
executor: python/default
steps:
- checkout # checkout source code to working directory
- run:
name: Install PlatformIO
command: pip install --upgrade platformio
- run:
name: Compile Project
command: pio run
- run:
name: Creating Dummy Artifacts
command: |
cd .pio/build/esp32dev
echo "firmare.bin" > /tmp/art-1;
mkdir /tmp/artifacts;
echo "my artifact files in a dir" > /tmp/artifacts/art-2;
- store_artifacts:
path: /tmp/art-1
destination: artifact-file
- store_artifacts:
path: /tmp/artifacts
workflows:
main:
jobs:
- build
I would like to store the artifact the firmware.bin in a bucket in aws...
Do you know how to do it or a similar example that I can check and modify ?
Thanks a lot
I guess the simple option is to use CircleCI's circleci/aws-s3 orb.
I have created a pipeline for running automation script from bitbucket, when I trigger build with docker container all custom variable is working (it pass the correct values) but when I run the same project in self.hosted machine and pass the variables it show blank values.
Below is the sample of pipeline file
# This is an example Starter pipeline configuration
# Use a skeleton to build, test and deploy using manual and parallel steps
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: atlassian/default-image:2
pipelines:
pull-requests: #Trigger pipeline project on each Pull-Request
'**':
- step:
name: 'version check'
image: maven:3.3.9
caches:
- maven
script:
- echo "Your versions here..."
- mvn --version
- step:
name: 'Clean and Build'
script:
- mvn -f TestAutomation/pom.xml clean compile
custom:
Automation-Run: #Name of this pipeline
- variables:
- name: testngFile
default: "src/test/resources/testng"
- name: browser
default: "CHROME"
allowed-values: # optionally restrict variable values
- "CHROME"
- "FIREFOX"
- name: environment
default: STAGING
allowed-values:
- "STAGING"
- "QA"
- "PROD"
- name: forkCount
default: "0"
- name: tags
default: Regression
- step:
name: 'Connect to Runner & Automation-Run'
runs-on:
- self.hosted
- windows
- testautomation
script:
- cd TestAutomation
- .\Example1.bat ${testngFile} ${browser} ${environment} ${tags}
artifacts:
- /target/surefire-reports/**.xml
inside Example1.bat file I have mentioned below command
mvn clean test -Dproject.testngFile=%1 -Dbrowser.name=%2 -Dproject.environment=%3 -Dcucumber.filter.tags=#%4
enter image description here
enter image description here
I am expecting when user enter any values, it picked and stored into variable and those variables are pass to Example1.bat as runtime command line args.
Having trouble deploying to HEROKU with CircleCI. I have already tested deploying git push heroku master to heroku manually, which is working. However when I use CircleCI, deployment no longer works.
Github repo url: https://github.com/dulerong/vue-test-circleci
I have set HEROKU environment variables in CircleCI project setting.
HEROKU_API_KEY=my_key
HEROKU_APP_NAME=my_app_name
Error message follows.
#!/bin/bash -eo pipefail
if false;then
force="-f"
fi
heroku_url="https://heroku:$HEROKU_API_KEY#git.heroku.com/$HEROKU_APP_NAME.git"
if [ -n "$CIRCLE_BRANCH" ]; then
git push $force $heroku_url $CIRCLE_BRANCH:main
elif [ -n "$CIRCLE_TAG" ]; then
git push $force $heroku_url $CIRCLE_TAG^{}:main
else
echo "No branch or tag found."
exit 1
fi
fatal: Not a git repository (or any of the parent directories): .git
Exited with code exit status 128
CircleCI received exit code 128
Below is my circleCI config.yml
version: 2.1
orbs:
heroku: circleci/heroku#1.2.5
jobs:
build-job:
working_directory: ~/repo
docker:
- image: circleci/node:12.18.2
steps:
- checkout
- run:
name: Install dependencies
command: npm install
- run:
name: Build
command: npm run build
- save_cache:
key: dependency-cache-{{ checksum "package-lock.json" }}
paths:
- ./node_modules
- run:
name: lint
command: npm run lint
- run:
name: test
command: npm run test:unit
deploy-job:
working_directory: ~/repo
docker:
- image: circleci/node:12.18.2
steps:
- attach_workspace:
at: ~/repo
- heroku/deploy-via-git
workflows:
version: 2.1
deploy:
jobs:
- build-job
- deploy-job:
requires:
- build-job
filters:
branches:
only: master
I have linked CircleCI to my Github repo
I have created .circleci folder config.yml
I have created an app on heroku, which works when I deploy manually
The build part of my CircleCI works, however deployment does not work
Any help is appreciated, thanks in advance.
Found out what I was missing.
- checkout
I was missing this line of code in my deploy-job. Hence after changing the deploy-job yml config code to following, everything worked.
deploy-job:
working_directory: ~/repo
docker:
- image: circleci/node:12.18.2
steps:
- checkout<--- INSERT THIS CODE HERE!!!!
- attach_workspace:
at: ~/repo
- heroku/deploy-via-git
Reason: checkout command leads CircleCI to the root directory of your project. Hence without this line of code, you're looking at a folder directory that's not even the root of your project.
Other useful command include
- run:
name: show directory
command: pwd
- run:
name: look in directory
command: ls -ltr
If you place those commands beneath checkouk, and look into the job progress in your CircleCI project, you can actually see which directory CircleCI is looking at, during that exact moment, very useful to check which directory CircleCI is working in. I put in those two commands and found out that my CircleCI was not looking at the root directory, hence discovering my problem.
Took me a few hours to figure this out!!!
So I'm running in to an error where I have a simple front end login test to a website using selenium. When I run the test in the bitbucket pipelines I'm running in to this error
java.lang.IllegalStateException: The driver executable does not exist: /opt/atlassian/pipelines/agent/build\chromedriver.exe
Bitbucket yml file
image: gradle:6.6.0
pipelines:
default:
- parallel:
- step:
name: Build and Test
caches:
- gradle
script:
- gradle build
after-script:
- pipe: atlassian/checkstyle-report:0.2.0
- step:
name: Security Scan
script:
# Run a security scan for sensitive data.
# See more security tools at https://bitbucket.org/product/features/pipelines/integrations?&category=security
- pipe: atlassian/git-secrets-scan:0.4.3
Does anyone know what the issue may be ?
I see 2 things:
You are specifying the driver file so the route could be incorrect.
java.lang.IllegalStateException: The driver executable does not exist: /opt/atlassian/pipelines/agent/build\chromedriver.exe
You are using a gradle image
image: gradle:6.6.0
but I don't think that you have a driver/browser in that image.
You will need to add another image with a browser, like this https://hub.docker.com/r/selenium/standalone-chrome, you can find more examples here https://github.com/SeleniumHQ/docker-selenium and add it to your file. Something like this:
image: gradle:6.6.0
pipelines:
default:
- parallel:
- step:
name: Build and Test
caches:
- gradle
services:
- chrome
script:
- gradle build
after-script:
- pipe: atlassian/checkstyle-report:0.2.0
- step:
name: Security Scan
script:
# Run a security scan for sensitive data.
# See more security tools at https://bitbucket.org/product/features/pipelines/integrations?&category=security
- pipe: atlassian/git-secrets-scan:0.4.3
definitions:
services:
chrome:
image: selenium/standalone-chrome
You will need to change your code to use a RemoteWebDriver
https://www.selenium.dev/documentation/en/remote_webdriver/remote_webdriver_client/
I'm a newbie to to CI/CD stuff and I've been trying for a couple of days to deploy an application to our bucket at AWS S3.
I tried this:
https://medium.freecodecamp.org/how-to-set-up-continuous-deployment-to-aws-s3-using-circleci-in-under-30-minutes-a8e268284098
this:
https://circleci.com/docs/1.0/continuous-deployment-with-amazon-s3/
And this:
https://medium.com/#zlwaterfield/circleci-s3-upload-dbffa0956b6f
But somehow I wasn't able to succeed with my attempt to do so. Circleci says my file successful was build, but somehow no deploy was made and no error msg was received. My AWS permissions are set, so it's being really frustrating this task.
Here's my final file:
jobs:
build:
docker:
-
image: "circleci/openjdk:8-jdk"
environment:
JVM_OPTS: "-Xmx3200m"
TERM: dumb
steps:
- checkout
-
restore_cache:
keys:
- "v1-dependencies-{{ checksum \"build.gradle\" }}"
- v1-dependencies-
-
run: "gradle dependencies"
-
save_cache:
key: "v1-dependencies-{{ checksum \"build.gradle\" }}"
paths:
- ~/.gradle
-
run: "gradle test"
working_directory: ~/repo
deploy:
machine:
enabled: true
steps:
-
run:
command: 'aws s3 sync ${myAppName}/ s3://${myBucketName} --region us-west-2'
name: Deploy
working_directory: ~/repo
version: 2
Updated: I was able to find a way. Here's my solution in case anyone needs it:
jobs:
build:
docker:
-
image: "circleci/openjdk:8-jdk"
environment:
JVM_OPTS: "-Xmx3200m"
TERM: dumb
steps:
- checkout
-
restore_cache:
keys:
- "v1-dependencies-{{ checksum \"build.gradle\" }}"
- v1-dependencies-
-
run: "gradle dependencies"
-
save_cache:
key: "v1-dependencies-{{ checksum \"build.gradle\" }}"
paths:
- ~/.gradle
-
run: "gradle build"
-
run: "gradle test"
- run:
command: "sudo apt-get -y -qq install awscli"
name: "Install awscli"
-
run:
command: "aws configure list"
name: "show credentials"
-
run:
command: "aws s3 ls"
name: "List all buckets"
-
run:
command: "aws s3 sync /tmp/app/myProject/build/libs s3://my-aws-bucket"
name: "Deploy to my AWS bucket"
working_directory: /tmp/app
version: 2
workflows:
build-deploy:
jobs:
-
build-job:
filters:
branches:
only:
- /development.*/
- /staging.*/
version: 2