Hi,
I have a Github Action setup to trigger a CodeFresh Pipeline using codefresh-pipeline-runner on Git Push as well as every 15 minutes in as a scheduled job. On Git Push, the trigger works perfectly fine and my CodeFresh Pipeline (run automated tests) gets run correctly. However, when the cron job triggers the CodeFresh Pipeline, it returns the following errors “Error: Missing branch or repo for a git trigger”:
Run codefresh-io/codefresh-pipeline-runner@v5
/usr/bin/docker run --name a7a50ec4274a8a440aa8f60f902655608a_61dedc --label 9916a7 --workdir /github/workspace --rm -e PIPELINE_NAME -e TRIGGER_NAME -e CF_API_KEY -e CF_BRANCH -e CF_REPO_NAME -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/vcmstest/vcmstest":"/github/workspace" 9916a7:a50ec4274a8a440aa8f60f902655608a
jq: error: head/0 is not defined at <top-level>, line 1:
head.ref
jq: 1 compile error
Created new context: context
Switched to context: context
Command: codefresh auth
Description:
Manage authentication contexts.
The loading order follows these rules:
1. If $CF_API_KEY environment variable is set, then it will be used as the current-context ($CF_URL can be used for custom Codefresh systems).
2. If the --cfconfig flag is set, then only that file is loaded. The flag may only be set once.
3. If $CFCONFIG environment variable is set, then it is used as the cfconfig file path.
4. Otherwise, ${HOME}/.cfconfig is used.
Commands:
codefresh auth create-context [name] Create or update an authentication context.
codefresh auth current-context Get the current activated authentication context.
codefresh auth get-contexts Get all possible authentication contexts.
codefresh auth use-context <name> Set the current active authentication context.
Options:
--insecure disable certificate validation for TLS connections (e.g. to g.codefresh.io) [boolean]
--help Show help [boolean]
--cfconfig Custom path for authentication contexts config file (default: '/github/home/.cfconfig')
Error: Missing branch or repo for a git trigger
Could you please let me know what I need to do to fix the problem with the scheduled job? I have already specified a value for $CF_BRANCH variable in my Github Action yaml file but still no luck. Here’s what my action.yaml file looks like:
# This is a basic workflow to help you get started with Actions
name: CI
on:
#schedule:
# - cron: '*/15 * * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
push:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
environment: test
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@master
- name: 'run codefresh pipeline job as test'
uses: codefresh-io/codefresh-pipeline-runner@v5
env:
PIPELINE_NAME: 'integration-tests/integration-tests'
TRIGGER_NAME: 'run-metadata-tests'
CF_API_KEY: '99999503f2c58260d40babc8.7b4389cf138db4a281b74c1e6541ef40'
CF_BRANCH: 'master'
id: run-pipeline
Hi Kostis,
Thanks for the reply. I have opened a support ticket and look forward to your team’s help. FYI, no build was created on the CodeFresh side because of the errors.