Skip to content

Commit

Permalink
CI: remove Kosli github-issue ticket evidence (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonJagger committed Feb 13, 2024
1 parent 1c94318 commit 9e4f067
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 80 deletions.
40 changes: 1 addition & 39 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,44 +46,6 @@ jobs:
echo "image_tag=${IMAGE_TAG}" >> ${GITHUB_OUTPUT}
echo "image_name=cyberdojo/dashboard:${IMAGE_TAG}" >> ${GITHUB_OUTPUT}
ticket:
needs: [kosli-trail]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Kosli CLI
uses: kosli-dev/setup-cli-action@v2
with:
version: ${{ vars.KOSLI_CLI_VERSION }}

- name: Check git-commit message references a Github Issue
run: |
export COMMIT_MESSAGE=$(git log --format=%B -n 1 ${{ github.sha }})
# Issue number can be specified as #1 or gh-1
export GITHUB_ISSUE_NUMBER=$(echo $COMMIT_MESSAGE | grep -oE '(#|gh-)[0-9]+' | head -n 1 | grep -oE '[0-9]+')
HTTP_CODE=$(curl --output /dev/null --location \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
--write-out "%{http_code}" \
--silent \
https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${GITHUB_ISSUE_NUMBER})
if [[ ${HTTP_CODE} -eq 200 ]]; then
export KOSLI_COMPLIANT=true
export EXTERNAL_URL="--external-url=issue=https://github.com/${GITHUB_REPOSITORY}/issues/${GITHUB_ISSUE_NUMBER}"
else
export KOSLI_COMPLIANT=false
export EXTERNAL_URL=
fi
kosli attest generic \
--compliant="${KOSLI_COMPLIANT}" \
${EXTERNAL_URL} \
--name=dashboard.ticket
lint:
needs: [kosli-trail]
Expand Down Expand Up @@ -231,7 +193,7 @@ jobs:


sdlc-control-gate:
needs: [ticket, lint, pull-request, unit-tests, snyk-scan, kosli-trail, build-image]
needs: [lint, pull-request, unit-tests, snyk-scan, kosli-trail, build-image]
runs-on: ubuntu-latest
env:
IMAGE_NAME: ${{ needs.kosli-trail.outputs.image_name }}
Expand Down
39 changes: 0 additions & 39 deletions .github/workflows/main_staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,46 +45,7 @@ jobs:
IMAGE_TAG=${GITHUB_SHA:0:7}
echo "image_tag=${IMAGE_TAG}" >> ${GITHUB_OUTPUT}
echo "image_name=cyberdojo/dashboard:${IMAGE_TAG}" >> ${GITHUB_OUTPUT}
ticket:
needs: [kosli-trail]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Kosli CLI
uses: kosli-dev/setup-cli-action@v2
with:
version: ${{ vars.KOSLI_CLI_VERSION }}

- name: Check git-commit message references a Github Issue
run: |
export COMMIT_MESSAGE=$(git log --format=%B -n 1 ${{ github.sha }})
# Issue number can be specified as #1 or gh-1
export GITHUB_ISSUE_NUMBER=$(echo $COMMIT_MESSAGE | grep -oE '(#|gh-)[0-9]+' | head -n 1 | grep -oE '[0-9]+')
HTTP_CODE=$(curl --output /dev/null --location \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
--write-out "%{http_code}" \
--silent \
https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${GITHUB_ISSUE_NUMBER})
if [[ ${HTTP_CODE} -eq 200 ]]; then
export KOSLI_COMPLIANT=true
export EXTERNAL_URL="--external-url=issue=https://github.com/${GITHUB_REPOSITORY}/issues/${GITHUB_ISSUE_NUMBER}"
else
export KOSLI_COMPLIANT=false
export EXTERNAL_URL=
fi
kosli attest generic \
--compliant="${KOSLI_COMPLIANT}" \
${EXTERNAL_URL} \
--name=dashboard.ticket
lint:
needs: [kosli-trail]
Expand Down
2 changes: 0 additions & 2 deletions .kosli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ trail:
artifacts:
- name: dashboard
attestations:
- name: ticket
type: generic
- name: lint
type: generic
- name: pull-request
Expand Down

0 comments on commit 9e4f067

Please sign in to comment.