feat(accept-risk) accept posture risk #1664
Workflow file for this run
This file contains 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
name: Terraform Provider Docs | |
on: | |
pull_request: | |
branches: | |
- master | |
env: | |
TERRAFORM_VERSION: "0.14.8" | |
GO_VERSION: "^1.17" | |
jobs: | |
go_build: | |
name: go build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
continue-on-error: true | |
id: cache-terraform-plugin-dir | |
timeout-minutes: 2 | |
with: | |
path: terraform-plugin-dir | |
key: ${{ runner.os }}-terraform-plugin-dir-${{ hashFiles('go.sum') }}-${{ hashFiles('sysdig/**') }} | |
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure' | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
check-latest: true | |
cache: true | |
# See also: https://github.com/actions/setup-go/issues/54 | |
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure' | |
name: go env | |
run: | | |
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV | |
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure' | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.GOCACHE }} | |
key: ${{ runner.os }}-GOCACHE-${{ hashFiles('go.sum') }}-${{ hashFiles('sysdig/**') }} | |
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure' | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }} | |
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure' | |
name: go build | |
run: go build -o terraform-plugin-dir/registry.terraform.io/sysdiglabs/sysdig/99.99.99/$(go env GOOS)_$(go env GOARCH)/terraform-provider-sysdig . | |
terraform_providers_schema: | |
name: terraform providers schema | |
needs: [ go_build ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
continue-on-error: true | |
id: cache-terraform-providers-schema | |
timeout-minutes: 2 | |
with: | |
path: terraform-providers-schema | |
key: ${{ runner.os }}-terraform-providers-schema-${{ hashFiles('go.sum') }}-${{ hashFiles('sysdig/**') }} | |
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure' | |
uses: actions/cache@v2 | |
timeout-minutes: 2 | |
with: | |
path: terraform-plugin-dir | |
key: ${{ runner.os }}-terraform-plugin-dir-${{ hashFiles('go.sum') }}-${{ hashFiles('sysdig/**') }} | |
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure' | |
uses: hashicorp/setup-terraform@v1 | |
with: | |
terraform_version: ${{ env.TERRAFORM_VERSION }} | |
terraform_wrapper: false | |
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure' | |
name: terraform init | |
run: | | |
# We need a file to initialize the provider | |
cat <<EOF > main.tf | |
terraform { | |
required_providers { sysdig = { source = "sysdiglabs/sysdig" } } | |
} | |
EOF | |
terraform init -plugin-dir terraform-plugin-dir | |
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure' | |
name: terraform providers schema | |
run: | | |
mkdir terraform-providers-schema | |
terraform providers schema -json > terraform-providers-schema/schema.json | |
tfproviderdocs: | |
needs: [ terraform_providers_schema ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
check-latest: true | |
cache: true | |
- uses: actions/cache@v2 | |
continue-on-error: true | |
timeout-minutes: 2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }} | |
- run: cd /tmp && go install github.com/bflad/tfproviderdocs@latest | |
- uses: actions/cache@v2 | |
timeout-minutes: 2 | |
with: | |
path: terraform-providers-schema | |
key: ${{ runner.os }}-terraform-providers-schema-${{ hashFiles('go.sum') }}-${{ hashFiles('sysdig/**') }} | |
- name: tfproviderdocs check | |
run: | | |
tfproviderdocs check \ | |
-allowed-resource-subcategories-file website/allowed-subcategories.txt \ | |
-enable-contents-check \ | |
-provider-source registry.terraform.io/sysdiglabs/sysdig \ | |
-providers-schema-json terraform-providers-schema/schema.json \ | |
-require-resource-subcategory |