Skip to content

Commit

Permalink
SCANDOCKER-3 Change Release pipeline to support the new version format
Browse files Browse the repository at this point in the history
  • Loading branch information
csaba-feher-sonarsource committed May 16, 2024
1 parent f048240 commit 8d4d12f
Showing 1 changed file with 34 additions and 33 deletions.
67 changes: 34 additions & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Release-test
name: Release

on:
push:
branches:
- bugfix/cfeher/SCANDOCKER-3-update-release-pipeline-to-support-new-versioning
release:
types:
- published

jobs:
release:
Expand All @@ -22,12 +22,13 @@ jobs:
development/kv/data/docker/sonardockerrw access_token_rwd | docker_access_token;
development/kv/data/docker/sonardockerrw username | docker_username;
development/artifactory/token/{REPO_OWNER_NAME_DASH}-docker-release access_token | repox_access_token;
development/kv/data/slack webhook | slack_webhook;
- name: Get the version
id: get_version
run: |
full_image_tag=10.2.0_5.0.2
full_image_tag=${{ github.event.release.tag_name }}
if [[ ! ${full_image_tag} =~ ^[1-9][0-9]+.[0-9]+.[0-9]+_[0-9]+.[0-9]+.[0-9]+ ]]; then
echo "The release tag should be in the format of {major}.{minor}.{patch}+{scanner_major}.{scanner_minor}.{scanner_patch} and it was ${full_image_tag}"
echo "The release tag should be in the format of {major}.{minor}.{patch}+{scanner_major}.{scanner_minor}.{scanner_patch} but it was ${full_image_tag}"
exit 1
fi
Expand Down Expand Up @@ -72,30 +73,30 @@ jobs:
env:
GPG_PRIVATE_KEY_PASSPHRASE: ${{ fromJSON(steps.secrets.outputs.vault).gpg_passphrase }}
GPG_PRIVATE_KEY_BASE64: ${{ fromJSON(steps.secrets.outputs.vault).gpg_key }}
# - name: Push image
# run: |
# docker login --username ${{ fromJSON(steps.secrets.outputs.vault).docker_username }} --password-stdin <<< "${{ fromJSON(steps.secrets.outputs.vault).docker_access_token }}"
# docker push sonarsource/sonar-scanner-cli:${{ steps.get_version.outputs.major_version }}
# docker push sonarsource/sonar-scanner-cli:${{ steps.get_version.outputs.major_minor }}
# docker push sonarsource/sonar-scanner-cli:${{ steps.get_version.outputs.major_minor_patch }}
# docker push sonarsource/sonar-scanner-cli:latest
# docker login repox-sonarsource-docker-releases.jfrog.io --username vault-SonarSource-sonar-scanner-cli-docker-docker-release --password-stdin <<< "${{ fromJSON(steps.secrets.outputs.vault).repox_access_token }}"
# docker push repox-sonarsource-docker-releases.jfrog.io/sonarsource/sonar-scanner-cli:${{ steps.get_version.outputs.major_version }}
# docker push repox-sonarsource-docker-releases.jfrog.io/sonarsource/sonar-scanner-cli:${{ steps.get_version.outputs.major_minor }}
# docker push repox-sonarsource-docker-releases.jfrog.io/sonarsource/sonar-scanner-cli:${{ steps.get_version.outputs.major_minor_patch }}
# docker push repox-sonarsource-docker-releases.jfrog.io/sonarsource/sonar-scanner-cli:latest
# - name: Notify success on Slack
# uses: Ilshidur/action-slack@2.1.0
# env:
# SLACK_CHANNEL: squad-analysis-experience
# SLACK_WEBHOOK: ${{ fromJSON(steps.secrets.outputs.vault).slack_webhook }}
# with:
# args: "Release successful for {{ GITHUB_REPOSITORY }} by {{ GITHUB_ACTOR }}"
# - name: Notify failures on Slack
# uses: Ilshidur/action-slack@2.1.0
# if: failure()
# env:
# SLACK_CHANNEL: squad-analysis-experience
# SLACK_WEBHOOK: ${{ fromJSON(steps.secrets.outputs.vault).slack_webhook }}
# with:
# args: "Release failed, see the logs at https://github.com/{{ GITHUB_REPOSITORY }}/actions by {{ GITHUB_ACTOR }}"
- name: Push image
run: |
docker login --username ${{ fromJSON(steps.secrets.outputs.vault).docker_username }} --password-stdin <<< "${{ fromJSON(steps.secrets.outputs.vault).docker_access_token }}"
docker push sonarsource/sonar-scanner-cli:${{ steps.get_version.outputs.major_version }}
docker push sonarsource/sonar-scanner-cli:${{ steps.get_version.outputs.major_minor }}
docker push sonarsource/sonar-scanner-cli:${{ steps.get_version.outputs.major_minor_patch }}
docker push sonarsource/sonar-scanner-cli:latest
docker login repox-sonarsource-docker-releases.jfrog.io --username vault-SonarSource-sonar-scanner-cli-docker-docker-release --password-stdin <<< "${{ fromJSON(steps.secrets.outputs.vault).repox_access_token }}"
docker push repox-sonarsource-docker-releases.jfrog.io/sonarsource/sonar-scanner-cli:${{ steps.get_version.outputs.major_version }}
docker push repox-sonarsource-docker-releases.jfrog.io/sonarsource/sonar-scanner-cli:${{ steps.get_version.outputs.major_minor }}
docker push repox-sonarsource-docker-releases.jfrog.io/sonarsource/sonar-scanner-cli:${{ steps.get_version.outputs.major_minor_patch }}
docker push repox-sonarsource-docker-releases.jfrog.io/sonarsource/sonar-scanner-cli:latest
- name: Notify success on Slack
uses: Ilshidur/action-slack@2.1.0
env:
SLACK_CHANNEL: squad-analysis-experience
SLACK_WEBHOOK: ${{ fromJSON(steps.secrets.outputs.vault).slack_webhook }}
with:
args: "Release successful for {{ GITHUB_REPOSITORY }} by {{ GITHUB_ACTOR }}"
- name: Notify failures on Slack
uses: Ilshidur/action-slack@2.1.0
if: failure()
env:
SLACK_CHANNEL: squad-analysis-experience
SLACK_WEBHOOK: ${{ fromJSON(steps.secrets.outputs.vault).slack_webhook }}
with:
args: "Release failed, see the logs at https://github.com/{{ GITHUB_REPOSITORY }}/actions by {{ GITHUB_ACTOR }}"

0 comments on commit 8d4d12f

Please sign in to comment.