forked from conforma/cli
-
Notifications
You must be signed in to change notification settings - Fork 1
add original acceptance tests #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ascerra
wants to merge
7
commits into
main
Choose a base branch
from
sealights
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
302ea1c
add ec-cli-sealights workflow
ascerra c333b2c
fix "" issue
ascerra e4617bd
simplify comments
ascerra b7e935b
fix
ascerra 5e06df4
update build name
ascerra 32e7535
test code change
ascerra df4de0f
cceptance tests
ascerra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,179 @@ | ||
| # Copyright The Enterprise Contract Contributors | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| --- | ||
| name: Sealights | ||
|
|
||
| "on": | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| - release-* | ||
| push: | ||
| branches: | ||
| - main | ||
| - release-* | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.pull_request.number) || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
|
|
||
| Initialize: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| SEALIGHTS_LOG_LEVEL: none | ||
| outputs: | ||
| bsid: ${{ steps.set-bsid.outputs.bsid }} | ||
| steps: | ||
| - name: Determine workflow run event context | ||
| run: echo "on-event=${{ github.event_name }}" >> $GITHUB_ENV | ||
|
|
||
| - name: Handle invalid context for pull requests | ||
| if: ${{ env.on-event == 'pull_request' && (!github.event.pull_request.head.sha || !github.event.pull_request.number) }} | ||
| run: | | ||
| echo "Invalid context for this workflow run. Exiting." | ||
| exit 1 | ||
|
|
||
| - name: Checkout repository | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| # Needed in hack/derive-version.sh | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Restore Cache | ||
| uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 | ||
| with: | ||
| key: main | ||
| path: '**' | ||
|
|
||
| - name: Setup Go environment | ||
| uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 | ||
| with: | ||
| go-version-file: go.mod | ||
| cache: false | ||
|
|
||
| - name: Check go versions | ||
| uses: enterprise-contract/github-workflows/golang-version-check@main | ||
|
|
||
| - name: Download SeaLights Go agent and CLI tool | ||
| run: | | ||
| echo "[Sealights] Downloading Sealights Golang & CLI Agents..." | ||
| case $(lscpu | awk '/Architecture:/{print $2}') in | ||
| x86_64) SL_ARCH="linux-amd64";; | ||
| arm) SL_ARCH="linux-arm64";; | ||
| esac | ||
| wget -nv -O sealights-go-agent.tar.gz https://agents.sealights.co/slgoagent/latest/slgoagent-$SL_ARCH.tar.gz | ||
| wget -nv -O sealights-slcli.tar.gz https://agents.sealights.co/slcli/latest/slcli-$SL_ARCH.tar.gz | ||
| tar -xzf ./sealights-go-agent.tar.gz && tar -xzf ./sealights-slcli.tar.gz | ||
| rm -f ./sealights-go-agent.tar.gz ./sealights-slcli.tar.gz | ||
| ./slgoagent -v 2> /dev/null | grep version && ./slcli -v 2> /dev/null | grep version | ||
|
|
||
| - name: Write SeaLights token into file | ||
| run: echo "${SEALIGHTS_AGENT_TOKEN}" > sltoken.txt | ||
| env: | ||
| SEALIGHTS_AGENT_TOKEN: '${{secrets.SEALIGHTS_AGENT_TOKEN}}' | ||
|
|
||
| - name: Initiating the SeaLights agent | ||
| run: | | ||
| echo "[Sealights] Initiating the SeaLights agent to Golang and handing it the token" | ||
| ./slcli config init --lang go --token ./sltoken.txt | ||
|
|
||
| - name: Configuring SeaLights - on pull_request event | ||
| if: env.on-event == 'pull_request' | ||
| run: | | ||
| echo "[Sealights] Configuring SeaLights to scan the pull request branch" | ||
| echo "Latest commit sha: ${LATEST_COMMIT_SHA}" | ||
| echo "PR Number: ${PULL_REQUEST_NUMBER}" | ||
| ./slcli config create-pr-bsid --app ec-cli --target-branch "main" --pull-request-number ${PULL_REQUEST_NUMBER} --latest-commit ${LATEST_COMMIT_SHA} --repository-url https://github.com/ascerra/ec-cli.git | ||
| env: | ||
| PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }} | ||
| LATEST_COMMIT_SHA: ${{github.event.pull_request.head.sha}} | ||
|
|
||
| - name: Configuring SeaLights - on push event | ||
| if: env.on-event == 'push' | ||
| run: | | ||
| echo "[Sealights] Configuring SeaLights to scan the main branch after pull request was closed" | ||
| ./slcli config create-bsid --app ec-cli --branch main --build ${LATEST_COMMIT_SHA} | ||
| env: | ||
| LATEST_COMMIT_SHA: ${{ github.sha }} | ||
|
|
||
| - name: Run the SeaLights scan | ||
| run: | | ||
| echo "[Sealights] Running the SeaLights scan" | ||
| ./slcli scan --bsid buildSessionId.txt --path-to-scanner ./slgoagent --workspacepath ./ --scm git --scmBaseUrl https://github.com/ascerra/ec-cli.git --scmVersion “0” --scmProvider github | ||
|
|
||
| - name: clean all SeaLights secret stuff | ||
| run: | | ||
| echo "[Sealights] Cleaning up after SeaLights run" | ||
| rm sltoken.txt | ||
|
|
||
| - name: Save workspace | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ${{ github.workspace }} | ||
| key: workspace-${{ github.run_id }} | ||
|
|
||
| Test: | ||
| runs-on: ubuntu-latest | ||
| needs: Initialize | ||
| env: | ||
| BSID: ${{ needs.Initialize.outputs.bsid }} | ||
| steps: | ||
| - name: Restore workspace | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ${{ github.workspace }} | ||
| key: workspace-${{ github.run_id }} | ||
|
|
||
| - name: Harden Runner | ||
| uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 | ||
| with: | ||
| egress-policy: audit | ||
| disable-telemetry: true | ||
|
|
||
| - name: Generate | ||
| run: make generate | ||
|
|
||
| - name: Test | ||
| run: make test | ||
|
|
||
| Acceptance: | ||
| runs-on: ubuntu-latest | ||
| needs: Initialize | ||
| env: | ||
| BSID: ${{ needs.Initialize.outputs.bsid }} | ||
| SEALIGHTS_LOG_LEVEL: none | ||
| steps: | ||
| - name: Restore workspace | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ${{ github.workspace }} | ||
| key: workspace-${{ github.run_id }} | ||
|
|
||
| - name: Update podman | ||
| run: | | ||
| "${GITHUB_WORKSPACE}/hack/ubuntu-podman-update.sh" | ||
|
|
||
| - name: Acceptance test | ||
| run: make acceptance | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.