Chromatic deployment error when using github-actions - devops

I am working on a React project which is using storybook, I'm trying to publish this storybook into chromatic with GitHub actions. I am using their sample chromatic.yml with just a few changes to match my project needs. Running the chromatic-cli my storybook is desployed succesflly but when I use GitHub actions the following error is displayed:
Error: ✖ Failed to collect Storybook metadata
Could not find a supported Storybook viewlayer package. Make sure one is installed, or set CHROMATIC_STORYBOOK_VERSION.
Here's the full error log:
Run chromaui/action#v1
with:
projectToken: ***
Chromatic CLI v5.7.0
https://www.chromatic.com/docs/cli
Authenticating with Chromatic
→ Connecting to https://index.chromatic.com
Authenticated with Chromatic
→ Using project token '********119f'
Retrieving git information
Retrieved git information
→ Commit 'a9f9af7' on branch 'master'; found 1 baseline commit
Collecting Storybook metadata
→ Could not find a supported Storybook viewlayer package. Make sure one is installed, or set CHROMATIC_STORYBOOK_VERSION.
✖ Failed to collect Storybook metadata
Could not find a supported Storybook viewlayer package. Make sure one is installed, or set CHROMATIC_STORYBOOK_VERSION.
→ View the full stacktrace below
If you need help, please chat with us at https://www.chromatic.com/docs/cli for the fastest response.
You can also email the team at support#chromatic.com if chat is not an option.
Please provide us with the above CLI output and the following info:
{
"timestamp": "2021-04-23T22:03:58.789Z",
"sessionId": "2f736280-50df-4f2e-aa3d-00d90236cf61",
"gitVersion": "2.31.1",
"nodePlatform": "linux",
"nodeVersion": "12.13.1",
"packageName": "chromatic",
Error: non-zero exit code
"packageVersion": "5.7.0",
"flags": {
"projectToken": "***",
"fromCI": true,
"interactive": false,
"exitZeroOnChanges": true,
"exitOnceUploaded": false,
"allowConsoleErrors": false
},
"buildScript": "build-storybook",
"errorType": "Error",
"errorMessage": "✖ Failed to collect Storybook metadata"
}
Error: ✖ Failed to collect Storybook metadata
Could not find a supported Storybook viewlayer package. Make sure one is installed, or set CHROMATIC_STORYBOOK_VERSION.
at /home/runner/work/_actions/chromaui/action/v1/bin/lib/getStorybookInfo.js:83:11
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async getStorybookInfo (/home/runner/work/_actions/chromaui/action/v1/bin/lib/getStorybookInfo.js:115:25)
at async setStorybookInfo (/home/runner/work/_actions/chromaui/action/v1/bin/tasks/storybookInfo.js:6:42)
at async Task.task (/home/runner/work/_actions/chromaui/action/v1/bin/lib/tasks.js:13:7)
And this is my chromatic.yml
# Workflow name
name: "Chromatic Deployment"
# Event for the workflow
on:
push:
branches: [master, stagging, developing]
pull_request:
branches: [master, stagging, developing]
# List of jobs
jobs:
test:
# Operating System
runs-on: ubuntu-latest
defaults:
run:
working-directory: foo
# Job steps
steps:
- uses: actions/checkout#v1
- run: yarn
#👇 Adds Chromatic as a step in the workflow
- uses: chromaui/action#v1
# Options required for Chromatic's GitHub Action
with:
#👇 Chromatic projectToken, see https://storybook.js.org/tutorials/intro-to-storybook/react/en/deploy/ to obtain it
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

So here's what I found on chromatic's official repository:
https://github.com/chromaui/chromatic-cli/issues/227
https://github.com/chromaui/chromatic-cli/issues/324
https://github.com/chromaui/chromatic-cli/issues/197
There's a chance this problem originates from the fact I'm using a monorepo, I though using working-directory was enough to fix this but there an aditional parameter to be used chromaui, workinDir.
Here's my current chromatic.yml
# Workflow name
name: "Chromatic Deployment"
# Event for the workflow
on:
push:
branches: [master, stagging, developing]
pull_request:
branches: [master, stagging, developing]
# List of jobs
jobs:
chromatic-deployment:
# Operating System
runs-on: ubuntu-latest
defaults:
run:
working-directory: foo
# Job steps
steps:
- uses: actions/checkout#v1
- run: yarn
#👇 Adds Chromatic as a step in the workflow
- uses: chromaui/action#v1
# Options required for Chromatic's GitHub Action
with:
workingDir: foo
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

Related

How to read environment variables in env section of github action workflow

I'm trying to set a env variable based on another env variable in a github workflow. I've tried a couple of syntax options but none seem to work
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
env:
BASE_VERSION: 1.0.0
FULL_VERSION: ${BASE_VERSION}-${{ github.run_number }}-${{ github.ref_name }}
jobs:
The example for BASE_VERSION above just keeps ${BASE_VERSION} as a string
$BASE_VERSION also just keeps $BASE_VERSION as a string
${{ env.BASE_VERSION }}-blabla just fails with syntax error
Is this doable?
The output I want is "1.0.0-1-master" for example
Is this doable?
It does not seem like a supported behaviour at the moment.
The docs on env mentions that
variables in the env map cannot be defined in terms of other variables in the map.
Do it like this:
- name: Set docker image env var
run: |
echo "DOCKER_IMAGE=${ARTIFACTORY_URL}/${IMAGE_NAME}:${GITHUB_REF##*/}.${{github.run_number}}" >> $GITHUB_ENV
- run: |
echo ${{ env.DOCKER_IMAGE }}
Outputs
artifactory-host/some-project/some-repo/image-name:branch.number

is it possible to get cocopods session in GitHub CI workflow automatic

I am work in GitHub Actions to push a component to cocoapods, but the cocoapods need to get a session before push a lib. The process about the interaction was that the cocoapods send a email and click the link in the email. But the problem is I am in a automatic workflow. I can not click the email every time when publish the component. I want to get the session siliently and automaticlly. is it possible? Or I have to click the link in the email send by cocopods? This is the workflow script:
name: validate
on: [push]
jobs:
unit-tests:
runs-on: macos-latest
strategy:
matrix:
destination:
[
'platform=iOS Simulator,name=iPhone 12 Pro',
]
steps:
- name: Checkout Repo
uses: actions/checkout#v2
- name: Run Tests
run: |-
cd Example
xcodebuild test -scheme SwiftAudio-Example -destination "${destination}" -enableCodeCoverage YES
env:
destination: ${{ matrix.destination }}
- name: Get Sesssion
run: pod trunk register ${{ secrets.COCOPOD_GMAIL }} ${{ secrets.COCOPOD_USERNAME }} --verbose
- name: Push Repo to Cocoapods
run: pod trunk push SwiftAudioEx.podspec --allow-warnings
The solution is to use CocoaPods access token:
https://fuller.li/posts/automated-cocoapods-releases-with-ci/

CircleCI reports "No workflow" when creating a tagged release

I want to build a CircleCI workflow which builds and pushes to ECR only when I create a tagged release in Github.
I have the following CircleCI workflow:
workflows:
test-build-and-push-image:
jobs:
- get_python_dependencies
- unit_tests:
requires:
- get_python_dependencies
- aws-ecr/build-and-push-image:
name: build-and-push-to-ecr
repo: ${CIRCLE_PROJECT_REPONAME}
tag: ${CIRCLE_SHA1}
create-repo: true
requires:
- unit_tests
filters:
tags:
only: /.*/
branches:
ignore: /.*/
As I understand it, the filters on build-and-push-to-ecr are supposed to mean:
Run this job for any tag whatsoever
Don't run this job when pushing to any branch
But when I create a tagged release I get:
Why aren't my filters working?
A very close reading of the docs under Executing workflows for a git tag reveals a well-hidden detail:
if a job requires any other jobs (directly or indirectly), you must use regular expressions to specify tag filters for those jobs.
In other words, every job in the workflow must have the same filters for the build and push job to happen.
We can keep things a bit DRYer using & anchors:
workflows:
test-build-and-push-image:
jobs:
- get_python_dependencies:
filters: &tagged
# We only want to trigger this workflow on tags, not pushes to branches.
branches:
ignore: /.*/
tags:
# Trigger on every tag
only: /.*/
- unit_tests:
requires:
- get_python_dependencies
<<: *tagged
- aws-ecr/build-and-push-image:
name: build-and-push-to-ecr
repo: ${CIRCLE_PROJECT_REPONAME}
tag: ${CIRCLE_SHA1}
create-repo: true
requires:
- unit_tests
<<: *tagged

Remote Trigger Bamboo build from BitBucket Server webhook only on PR?

I'm new to bamboo and webhooks. I'm trying to start a bamboo build automatically when a PR to master branch from my repo is opened.
I followed this guide but the remote trigger is not starting at all.
Bamboo:
BitBucket:
I've already checked the following:
verify that the whitelisted ip is correct (the bitbucket webhook fails if i remove that)
my bamboo plan is enabled and is building fine on manual run
What am I missing?
Bamboo build plan in YAML:
---
oid: 7818389690603565060
key: XT
name: XXX - TEMP
project:
oid: 7819374853022025730
key: DIGQA
repositories:
- oid: 7818811903068661169
parentRepository: 7818811903068661168
triggers:
- name: Bitbucket Server repository triggered
description: ''
pluginKey: com.atlassian.bamboo.plugins.stash.atlassian-bamboo-plugin-stash:stashTrigger
enabled: true
configuration: {}
triggerConditions:
com.atlassian.bamboo.triggercondition.internal:plansGreenCondition:
enabled: 'false'
triggeringRepositories:
- 7818811903068661169
- name: Remote trigger
description: Master PR Trigger
pluginKey: com.atlassian.bamboo.triggers.atlassian-bamboo-triggers:remote
enabled: true
configuration:
repository.change.trigger.triggerIpAddress: 10.40.1.120
triggerConditions:
com.atlassian.bamboo.triggercondition.internal:plansGreenCondition:
enabled: 'false'
triggeringRepositories:
- 7818811903068661169
branchConfiguration:
planBranchCreation:
enabled: false
removedBranchCleanup:
enabled: false
inactiveBranchesCleanup:
enabled: false
merging:
enabled: false
notificationStrategy: notifyCommitters
triggers: inherited
issueLinking: enabled
dependencies:
configuration:
enabledForBranches: 'true'
requireAllStagesPassing: null
blockingStrategy: none
childPlans: []
permissions:
users:
xxxxxxxx:
- administration
- build
- clone
- read
- write
groups: {}
roles:
user:
- read
anonymous:
- read
plugins:
- pluginKey: com.atlassian.bamboo.plugin.system.additionalBuildConfiguration:concurrentBuild
configuration:
custom.concurrentBuilds.overrideNumberOfConcurrentBuilds: 'true'
custom.concurrentBuilds.numberOfConcurrentBuilds: '1'
- pluginKey: com.atlassian.bamboo.plugin.system.additionalBuildConfiguration:buildExpiry
configuration:
custom.buildExpiryConfig.enabled: 'false'
- pluginKey: com.atlassian.bamboo.plugin.artifact.handler.local:artifactHandlersConfiguration
configuration:
custom.artifactHandlers.useCustomArtifactHandlers: 'false'
buildDefinition:
custom.predefinedVariables: '{"variableSetList":[]}'
stages:
- oid: 7818530428091950756
name: Default Stage
jobs:
- oid: 7818671165580276746
key: JOB1
name: Default Job
tasks:
- oid: 7819234115533708305
description: Checkout Default Repository
pluginKey: com.atlassian.bamboo.plugins.vcs:task.vcs.checkout
configuration:
repositories:
- ref: defaultRepository
buildDefinition:
cleanWorkingDirectory: false
repositoryDefiningWorkingDirectory: -1
...
===========================================================================
EDIT 1:
Okay, so I realized the hook and the trigger is actually working. I misunderstood the trigger setup on bamboo.
Current behavior:
PR to master is opened
BitBucket webhook (on PR) is fired
Bamboo trigger is set to remote / bitbucket server repo. Because of this, the build will not start until the changes are commited / PR is actually merged
Problem:
I want the build to trigger once the PR is opened (before merge). To a bit more context, this is the ideal flow of my build:
Checkout the PR code (revision)
Run my tests against the PR revision
I'm looking at the following links as it seems they managed to do it somehow but I can't make sense of the bits of info provided in both the links.
bamboo - build my pull request
What's wrong with bamboo
Since you are using Bamboo and Bitbucket Server (not Cloud), follow the instructions here:
https://confluence.atlassian.com/bamboo/integrating-bamboo-with-bitbucket-server-779302772.html
You need to create an application link between Bamboo and BBS - application links are between Atlassian applications.
Found out that this feature is supported out of the box as of Bamboo 6+: Reference

jenkins-job-builder doesn't propagate a variable value

I am using jenkins-job-builder to create my pipeline project. But I have a problem with the variables values when I am trying to reuse or propagating.
It is my project configuration:
- project:
name: myproject
git_url: git#gitlabserver.cu:demos-products/myproject.git
jobs:
- '{name}-nfr-smoke-tests':
pipeline-next: '{name}-nfr-smoke-tests'
And here is my job-template:
- job-template:
name: "{name}-nfr-smoke-tests"
node: 'slave1'
scm:
- git:
skip-tag: false
url: 'git#gitlabserver.cu:test-products/{name}-nfr-tests.git'
branches:
- master
wipe-workspace: true
builders:
- shell: |
bundle install
bundle exec cucumber features/smoke.feature
publishers:
- trigger:
project: "{pipeline-next}"
threshold: SUCCESS
Ok, now when I run this configuration in jenkins and I check the job's construction, it says:
No such project ‘{name}-nfr-smoke-tests’. Did you mean ‘myproject-nfr-smoke-tests’?
Why the line: pipeline-next: '{name}-nfr-smoke-tests'doesn't propagates the value of variable name and just used it as a literal string? I am missing something.
You are missing 'name' under 'project' section in your job-template. Append the following lines:
- project:
name: project-name
The purpose of a project is to collect related jobs together, and provide values for the variables in a Job Template.
I found out that Jenkins Job Builder version 0.9.0-0.2 does not propagate the value, but for me version 1.3.0+2015.12.15.git136.959eb4b909-1 did. Perhaps updating your version of Jenkins Job Builder might help?

Resources