From 0f72cb2519db57dffa6fe500d680183544cf96ee Mon Sep 17 00:00:00 2001 From: Angelo Buono Date: Mon, 19 Aug 2024 15:45:26 +0200 Subject: [PATCH] SONARGO-7 Fix .github/workflows GO (#3) --- .github/workflows/releasability.yaml | 54 ++++++++++++++++++++++++++++ .github/workflows/release.yml | 4 +++ .github/workflows/slack_notify.yml | 13 +++++++ README.md | 2 +- 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/releasability.yaml create mode 100644 .github/workflows/slack_notify.yml diff --git a/.github/workflows/releasability.yaml b/.github/workflows/releasability.yaml new file mode 100644 index 00000000..b38c83a8 --- /dev/null +++ b/.github/workflows/releasability.yaml @@ -0,0 +1,54 @@ +name: Releasability status + +on: + workflow_dispatch: + # Inputs the workflow accepts. + inputs: + version: + description: Optional; Used to specify the version to check, otherwise pulls the latest master version from artifactory. + required: false + +jobs: + releasability-job: + name: Releasability check + runs-on: ubuntu-latest + permissions: + id-token: write # required by SonarSource/vault-action-wrapper + contents: read # required by checkout + steps: + - name: Retrieve Vault Secrets + id: secrets + uses: SonarSource/vault-action-wrapper@v3 + with: + secrets: | + development/artifactory/token/{REPO_OWNER_NAME_DASH}-private-reader access_token | ARTIFACTORY_PASSWORD; + development/artifactory/token/{REPO_OWNER_NAME_DASH}-private-reader role | ARTIFACTORY_ROLE; + development/kv/data/repox url | ARTIFACTORY_URL; + + - name: Get the latest available version number + id: latest-version + env: + ARTIFACTORY_PRIVATE_USERNAME: vault-${{ fromJSON(steps.secrets.outputs.vault).ARTIFACTORY_ROLE }} + ARTIFACTORY_PRIVATE_PASSWORD: ${{ fromJSON(steps.secrets.outputs.vault).ARTIFACTORY_PASSWORD }} + ARTIFACTORY_URL: ${{ fromJSON(steps.secrets.outputs.vault).ARTIFACTORY_URL }} + REPO: sonarsource-public-builds + GROUP_ID: org.sonarsource.slang + ARTIFACT_ID: sonar-go-plugin + run: | + if [[ -z "${{ github.event.inputs.version }}" ]]; then + echo "version not provided, pulling latest version from $REPO." + echo LATEST_VERSION=$(curl -s -u ${ARTIFACTORY_PRIVATE_USERNAME}:${ARTIFACTORY_PRIVATE_PASSWORD} \ + "${ARTIFACTORY_URL}/api/search/latestVersion?g=${GROUP_ID}&a=${ARTIFACT_ID}&repos=${REPO}") >> "$GITHUB_OUTPUT" + else + echo "version is provided, using its value: ${{ github.event.inputs.version }}." + echo "LATEST_VERSION=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT" + fi + + - uses: SonarSource/gh-action_releasability@v2 + id: releasability + with: + branch: ${{ github.ref_name }} + commit-sha: ${{ github.sha }} + organization: ${{ github.repository_owner }} + repository: ${{ github.event.repository.name }} + version: ${{ steps.latest-version.outputs.LATEST_VERSION }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ec3ef95b..fa5f8bc0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,3 +14,7 @@ jobs: id-token: write contents: write uses: SonarSource/gh-action_release/.github/workflows/main.yaml@v5 + with: + publishToBinaries: true + mavenCentralSync: true + slackChannel: squad-jvm-notifs diff --git a/.github/workflows/slack_notify.yml b/.github/workflows/slack_notify.yml new file mode 100644 index 00000000..ca1f8483 --- /dev/null +++ b/.github/workflows/slack_notify.yml @@ -0,0 +1,13 @@ +--- +name: Slack Notifications +on: + check_run: + types: [rerequested, completed] + +jobs: + slack-notifications: + permissions: + id-token: write # to authenticate via OIDC + uses: SonarSource/gh-action_build-notify/.github/workflows/main.yaml@v1 + with: + slackChannel: squad-jvm-notifs diff --git a/README.md b/README.md index 529b2a39..53e878b5 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=org.sonarsource.slang%3Aslang&metric=alert_status)](https://sonarcloud.io/dashboard?id=org.sonarsource.slang%3Aslang) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=org.sonarsource.slang%3Aslang&metric=coverage)](https://sonarcloud.io/component_measures/domain/Coverage?id=org.sonarsource.slang%3Aslang) -This is a developer documentation. If you want to analyze source code in SonarQube read one of the following documentation: +This is a developer documentation. If you want to analyze source code in SonarQube read the [analysis of Go documentation](https://docs.sonarqube.org/latest/analysis/languages/go/). We use the native Go parser to parse the Go language.