Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 43 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,47 @@ jobs:
command: cat .version
- <<: *persist_to_workspace

tag_version_ssh:
<<: *default_doks_image
parameters:
version:
type: string
default: ""
force:
type: boolean
default: false
steps:
- <<: *attach_workspace
- add_ssh_keys:
fingerprints:
- "df:83:d7:c7:d5:79:06:c2:3b:d1:fd:e2:a3:d1:12:c5"
- run:
name: Setup SSH
command: ssh-keyscan github.com >> ~/.ssh/known_hosts

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪ LOW RISK

Nitpick: Ensure the '~/.ssh' directory exists and use the '-H' flag for 'ssh-keyscan' to improve security and robustness.\n\nsuggestion\n command: mkdir -p ~/.ssh && ssh-keyscan -H github.com >> ~/.ssh/known_hosts\n

- run:
name: Set Git Config
command: |
git config --global user.email "circleci@codacy.com"
git config --global user.name "CircleCI"
git remote set-url origin git@github.com:codacy/chart.git

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM RISK

Suggestion: Avoid hardcoding the repository URL. Use CircleCI environment variables to construct the SSH URL dynamically.\n\nsuggestion\n git remote set-url origin "git@github.com:${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git"\n

- run:
name: Fetch Tags
command: git fetch --tags
- run:
name: Tag
command: |
TAG="<< parameters.version >>"
if [ -z "$TAG" ]; then
TAG=$(cat .version)
fi
if [ "<< parameters.force >>" = "true" ]; then
git tag -f "$TAG"
git push origin -f "refs/tags/$TAG"
else
git tag "$TAG"
git push origin "refs/tags/$TAG"
fi

build_docs:
docker:
- image: circleci/python:3.8
Expand Down Expand Up @@ -812,7 +853,7 @@ workflows:
requires:
- manual_qa_hold
- manual_solutions_eng_hold
- codacy/tag_version:
- tag_version_ssh:
name: tag_version
context: CodacyDO
requires:
Expand All @@ -826,7 +867,7 @@ workflows:
target_charts_repo_url: "https://charts.codacy.com/stable"
requires:
- tag_version
- codacy/tag_version:
- tag_version_ssh:
name: tag_version_latest
context: CodacyDO
version: latest
Expand Down