Dynamically setting docker image tag from semver when using docker-image-resource in concourse - docker-image

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}

Related

dbt found two resources with the same name

I'm hitting a strange error in dbt
I am using the following package to enable external tables in bigquery.
packages:
- package: dbt-labs/dbt_external_tables
version: 0.8.0
$ dbt run-operation stage_external_sources
An error occurred in the dbt Server. Please contact support if this issue persists.
RPC server failed to compile project, call the "status" method for compile status: Compilation Error
dbt found two resources with the name
"dbt_user_test_ext". Since these resources have the same name, dbt will be unable to find the correct resource when source("dbt_user", "test_ext") is used. To fix this change the name of one of these resources:
source.dbt_user.test_ext (models/sources.yml)
source.dbt_user.test_ext (models/sources.yml) Code: 10011
models/sources.yml looks something like this:
sources:
- name: "{{ target.schema }}"
tables:
- name: test_ext
external:
location: "gs://test-bucket/test_ext.csv"
options:
format: csv
skip_leading_rows: 1
Seems to only happen the after the first time I run the command.
Question: what am I doing wrong, and/or how to fix?

CircleCI is triggering slack notification before my Cypress tests run

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

Unexpected symbol: ‘2e4ce68d4e3feec97e992821e6391166943f4d49’

I tried to built github .yml file but I’m getting error like
|GitHub Actions/ Main Workflow
Invalid workflow file
The workflow is not valid. .github/workflows/build.yml (Line: 22, Col: 22): Unexpected symbol: '<hash_value>'. Located at position 9 within expression: secrets.<hash_value>|
CODE
on:
Trigger analysis when pushing in master or pull requests, and when creating
a pull request.
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
name: Main Workflow
jobs:
sonarcloud:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v2
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action#v1.3
env:
GITHUB_TOKEN: {{ secrets.<hash_value>}} SONAR_TOKEN: {{ secrets.<hash_value>}}
AND
#Configure here general information about the environment, such as SonarQube server connection details for example
#No information about specific project should appear here
#----- Default SonarQube server
sonar.host.url=https://sonarcloud.io/
#----- Default source code encoding
#sonar.sourceEncoding=UTF-8
sonar.organization=blah blah
sonar.projectKey=blah blah
— optional properties —
defaults to project key
sonar.projectName=Toolsdemo
defaults to ‘not provided’
sonar.projectVersion=1.0
Path is relative to the sonar-project.properties file. Defaults to .
sonar.sources=https://github.com/abcd/xyz
Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8
Please help . I need to test my code very fast .

Function "SaveSlotDetails" does not presented in serverless.yml

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

Drone.io auto_tag with branch name

Using the drone docker plugin in order to create my cloud images, I would like to simplify the workflow by having drone automatically tagging my images depending of the git branch name I'm working with.
I saw a auto_tag but unfortunately it always tag my images as "latest".
###
# Tag deployment
# Docker image
###
push-tag-news:
image: plugins/docker
registry: docker.domain.com:5000
secrets: [docker_username, docker_password]
repo: docker.domain.com:5000/devs/news
auto_tag: true # Or how to specify the current branch for the tags: option?
when:
exclude: [master, dev]
has anyone tried to do something similar?
I'm using drone 0.8
The auto_tag uses the repository/git tags seems to me you are looking to set custom docker image tags.
You can use any of these variables http://docs.drone.io/environment-reference/
Try using DRONE_COMMIT_BRANCH
build-docker-image:
image: plugins/docker
repo: myname/myrepo
secrets: [ docker_username, docker_password ]
tags:
- ${DRONE_COMMIT_BRANCH}
- latest