Attempting to run a file on a scheduled time (increasing the schedule later) but for some reason, it is not running at all. I am not sure if I have written it correctly.
name: updateStandingsDB
on:
schedule:
- cron: '*/1 * * * *'
jobs:
build-node:
runs-on: ubuntu-latest
container: node:16
steps:
- name: git checkout
uses: actions/checkout#v3
- name: Install
run: npm install
- name: Prem
run: node update-standings/prem.js
Could someone help me understand what I am doing wrong?
Per the documentation at GitHub you cannot set it the way you did:
The shortest interval you can run scheduled workflows is once every 5 minutes.
So I would recommend either trying */5 (or even */10) or simply committing with a fixed time (which is IIRC also in UTC) while you debug.
Related
I have written a github actions workflow yml file to schedule a job to run everyday at a particular time but it's not working. I have even used the cron written in official doc but still it is not working. Is it due to Indian TimeZone or some other reason??
name: run app.py
on:
schedule:
- cron: '30 4,17 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout#v3
- name: setup python
uses: actions/setup-python#v4
with:
python-version: '3.9' # install the python version needed
- name: install python packages
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: execute py script # run main.py
env:
DSA_SHEET: ${{ secrets.DSA_SHEET }}
run: python app.py
I have tried to change the cron many time but it was not working. It was only working when set to run every 5mins but when I set it to run everyday it is not working.
Github actions schedule is in UTC time.
https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
I had created a specific runner for my gitlab project,
its taking too long to run the pipeline.
Its is getting stuck in Cypress test mainly.
After "All Specs passed" it will not move forward.
- build
- test
build:
stage: build
image: gradle:jdk11
script:
- gradle --no-daemon build
artifacts:
paths:
- build/distributions
expire_in: 1 day
when: always
junit-test:
stage: test
image: gradle:jdk11
dependencies: []
script:
- gradle test
timeout: 5m
cypress-test:
stage: test
image: registry.gitlab.com/sahajsoft/gurukul2022/csv-parser-srijan:latestSrigin2
dependencies:
- build
script:
- unzip -q build/distributions/csv-parser-srijan-1.0-SNAPSHOT.zip -d build/distributions
- sh build/distributions/csv-parser-srijan-1.0-SNAPSHOT/bin/csv-parser-srijan &
- npm install --save-dev cypress-file-upload
- npx cypress run --browser chrome
A recommended approach is to try and replicate your script (from your pipeline) locally, from your computer.
It will allow to check:
how long those commands take
if there is any interactive step, where a command might expect a user entry, and wait for stdin.
The second point would explain why, in an unattended environment like a pipeline one, "it will not move forward".
Say I have this drone.yaml file:
kind: pipeline
type: kubernetes
name: default
- name: echo-hello
image: alpine
commands:
- echo "hello"
when:
event:
- push
- name: echo-goodbye
image: alpine
commands:
- echo "goodbye"
when:
event:
- push
In addition to triggering the echo-hello and echo-goodbye step upon each push, I'd like to trigger all steps based on a cron event. I thought adding the trigger section to the bottom of the yaml file would do the trick:
trigger:
event:
- cron
cron:
- hourly
But then, it ignores the conditions defined beneath when in the dedicated steps. Can anybody help me fixing my drone.yaml file, so that I can trigger by cron in addition to the step specific conditions?
Trigger mean that this whole pipeline will run only when cron runs it. You should add
event:
- cron
cron:
- hourly
to when: for each section.
I have gitlab project with ci file:
stages:
- build
- run
build:
stage: build
script:
- (some stuff)
tags:
- my_runner_tag
except:
- triggers
when: manual
run:
stage: run
script:
- (some stuff)
tags:
- my_runner_tag
except:
- triggers
when: manual
Jobs are created on every source code change, and they can be run only manually, using gitlab interface.
Now, i want to have possibility to trigger stage run with Gitlab API. Trying:
curl -X POST \
> -F token=xxxxxxxxxxxxxxx \
> -F ref=master \
> https://gitlab.xxxxx.com/api/v4/projects/5/trigger/pipeline
Returns:
{"message":{"base":["No stages / jobs for this pipeline."]}}
Seems, like i have to define stage to trigger, but i can't find a way to pass it via api call.
you are using the wrong endpoint, to do it, you need to follow the path below
list all of your pipelines and get the newest one
GET /projects/:id/pipelines
list the jobs from this pipeline
GET /projects/:id/pipelines/:pipeline_id/jobs
After that you can trigger your job
POST /projects/:id/jobs/:job_id/play
you are telling your build to run at all times except for the time they are being triggered (api call is also considered as a trigger).
change your job definition to the following:
run:
stage: run
script:
- (some stuff)
tags:
- my_runner_tag
when: manual
We have a project hosted on an internal Gitlab installation.
The Pipeline of the project has 3 stages:
Build
Tests
Deploy
The objective is to hide or disable the Deploy stage when Tests fails
The problem is that we can't use artifacts because they are lost each time our machines reboot.
My question: Is there an alternative solution to artifacts to achieve this task?
The used .gitlab-ci.yml looks like this:
stages:
- build
- tests
- deploy
build_job:
stage: build
tags:
# - ....
before_script:
# - ....
script:
# - ....
when: manual
only:
- develop
- master
all_tests:
stage: tests
tags:
# - ....
before_script:
# - ....
script:
# - ....
when: manual
only:
- develop
- master
prod:
stage: deploy
tags:
# - ....
script:
# - ....
when: manual
environment: prod
I think you might have misunderstood the purpose of the built-in CI. The goal is to have building and testing all automated on each commit or at least every push. Having all tasks set to manual execution gives you almost no advantage over external CI tools like Jenkins or Bamboo. Your only advantage to local execution of the targets right now is having visibility in a central place.
That said there is no way to conditionally show or hide CI tasks, because it's against the basic idea. If you insist on your idea, you could look up the artifacts of the previous stages and abort the manual execution in case something is wrong.
The problem is that we can't use artifacts because they are lost each time our machines reboot
AFAIK artifacts are uploaded to the master and not saved on the runners. You should be fine having your artifacts passed from stage to stage.
By the way, the default for when is on_success which means to execute build only when all builds from prior stages succeed.