From 9ec371ef8b34439868743bbfd35f12c05fc59bfb Mon Sep 17 00:00:00 2001 From: axuan Date: Wed, 13 Aug 2025 18:13:55 +0800 Subject: [PATCH 1/2] Add integration test --- vendor/github.com/go-logfmt/logfmt/README.md | 82 ++++++++++---------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/vendor/github.com/go-logfmt/logfmt/README.md b/vendor/github.com/go-logfmt/logfmt/README.md index 71c57944..9794502f 100644 --- a/vendor/github.com/go-logfmt/logfmt/README.md +++ b/vendor/github.com/go-logfmt/logfmt/README.md @@ -1,41 +1,41 @@ -# logfmt - -[![Go Reference](https://pkg.go.dev/badge/github.com/go-logfmt/logfmt.svg)](https://pkg.go.dev/github.com/go-logfmt/logfmt) -[![Go Report Card](https://goreportcard.com/badge/go-logfmt/logfmt)](https://goreportcard.com/report/go-logfmt/logfmt) -[![Github Actions](https://github.com/go-logfmt/logfmt/actions/workflows/test.yml/badge.svg)](https://github.com/go-logfmt/logfmt/actions/workflows/test.yml) -[![Coverage Status](https://coveralls.io/repos/github/go-logfmt/logfmt/badge.svg?branch=master)](https://coveralls.io/github/go-logfmt/logfmt?branch=main) - -Package logfmt implements utilities to marshal and unmarshal data in the [logfmt -format][fmt]. It provides an API similar to [encoding/json][json] and -[encoding/xml][xml]. - -[fmt]: https://brandur.org/logfmt -[json]: https://pkg.go.dev/encoding/json -[xml]: https://pkg.go.dev/encoding/xml - -The logfmt format was first documented by Brandur Leach in [this -article][origin]. The format has not been formally standardized. The most -authoritative public specification to date has been the documentation of a Go -Language [package][parser] written by Blake Mizerany and Keith Rarick. - -[origin]: https://brandur.org/logfmt -[parser]: https://pkg.go.dev/github.com/kr/logfmt - -## Goals - -This project attempts to conform as closely as possible to the prior art, while -also removing ambiguity where necessary to provide well behaved encoder and -decoder implementations. - -## Non-goals - -This project does not attempt to formally standardize the logfmt format. In the -event that logfmt is standardized this project would take conforming to the -standard as a goal. - -## Versioning - -This project publishes releases according to the Go language guidelines for -[developing and publishing modules][pub]. - -[pub]: https://go.dev/doc/modules/developing +# logfmt + +[![Go Reference](https://pkg.go.dev/badge/github.com/go-logfmt/logfmt.svg)](https://pkg.go.dev/github.com/go-logfmt/logfmt) +[![Go Report Card](https://goreportcard.com/badge/go-logfmt/logfmt)](https://goreportcard.com/report/go-logfmt/logfmt) +[![Github Actions](https://github.com/go-logfmt/logfmt/actions/workflows/test.yml/badge.svg)](https://github.com/go-logfmt/logfmt/actions/workflows/test.yml) +[![Coverage Status](https://coveralls.io/repos/github/go-logfmt/logfmt/badge.svg?branch=master)](https://coveralls.io/github/go-logfmt/logfmt?branch=main) + +Package logfmt implements utilities to marshal and unmarshal data in the [logfmt +format][fmt]. It provides an API similar to [encoding/json][json] and +[encoding/xml][xml]. + +[fmt]: https://brandur.org/logfmt +[json]: https://pkg.go.dev/encoding/json +[xml]: https://pkg.go.dev/encoding/xml + +The logfmt format was first documented by Brandur Leach in [this +article][origin]. The format has not been formally standardized. The most +authoritative public specification to date has been the documentation of a Go +Language [package][parser] written by Blake Mizerany and Keith Rarick. + +[origin]: https://brandur.org/logfmt +[parser]: https://pkg.go.dev/github.com/kr/logfmt + +## Goals + +This project attempts to conform as closely as possible to the prior art, while +also removing ambiguity where necessary to provide well behaved encoder and +decoder implementations. + +## Non-goals + +This project does not attempt to formally standardize the logfmt format. In the +event that logfmt is standardized this project would take conforming to the +standard as a goal. + +## Versioning + +This project publishes releases according to the Go language guidelines for +[developing and publishing modules][pub]. + +[pub]: https://go.dev/doc/modules/developing From ba919c78bf00db266bc89ec4e7ce881f0729c990 Mon Sep 17 00:00:00 2001 From: axuan Date: Wed, 13 Aug 2025 18:13:55 +0800 Subject: [PATCH 2/2] Add integration test --- .github/workflows/integration_test.yml | 130 +++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 .github/workflows/integration_test.yml diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml new file mode 100644 index 00000000..cd347e04 --- /dev/null +++ b/.github/workflows/integration_test.yml @@ -0,0 +1,130 @@ +name: integration_test.yml + +on: + push: + branches: + - main + pull_request: + +env: + COMPLYTIME_DEV_MODE: 1 + +jobs: + integration-test: + runs-on: ubuntu-latest + container: + image: fedora:latest + steps: + # Checkout the code from the repository + - name: Checkout code + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + +# - name: Setup lima +# uses: lima-vm/lima-actions/setup@v1 +# id: lima-actions-setup +# +# - name: Cache lima +# uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 +# with: +# path: ~/.cache/lima +# key: lima-${{ steps.lima-actions-setup.outputs.version }} +# +# - name: Start a fedora vm and enter shell +# run: | +# limactl start --name=default --cpus=1 --memory=1 --network=lima:user-v2 template://fedora +# lima sudo dnf install wget make scap-security-guide git go tree -y +# lima +# +# - run: | +# cp -r /home/runner/work/complyctl/complyctl /home/runner +# cd /home/runner/complyctl +# pwd +# ls -l + + # Step 2: Set up Go environment + - name: Set up Go + uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + with: + go-version-file: './go.mod' + + # Install dependency on fedora + - name: Install dependency + run: dnf install wget make scap-security-guide git tree -y + + # Configure Git for safe directory + - name: Configure Git for safe directory + run: git config --global --add safe.directory /__w/complyctl/complyctl + + # Build complyctl + - name: Build complyctl + run: make build + + # Configure complyctl + - name: Config compyctl + run: | + cp ./bin/complyctl /usr/local/bin + complyctl list 2>/dev/null || true + # download cusp OSCAL content + wget https://raw.githubusercontent.com/ComplianceAsCode/oscal-content/refs/heads/main/profiles/fedora-cusp_fedora-default/profile.json -O $HOME/.local/share/complytime/controls/cusp_profile.json + wget https://raw.githubusercontent.com/ComplianceAsCode/oscal-content/refs/heads/main/catalogs/cusp_fedora/catalog.json -O $HOME/.local/share/complytime/controls/cusp_catalog.json + wget https://raw.githubusercontent.com/ComplianceAsCode/oscal-content/refs/heads/main/component-definitions/fedora/fedora-cusp_fedora-default/component-definition.json -O $HOME/.local/share/complytime/bundles/cusp_component-definition.json + # update trestle path + sed -i 's|trestle://catalogs/cusp_fedora/catalog.json|trestle://controls/cusp_catalog.json|' $HOME/.local/share/complytime/controls/cusp_profile.json + sed -i 's|trestle://profiles/fedora-cusp_fedora-default/profile.json|trestle://controls/cusp_profile.json|' $HOME/.local/share/complytime/bundles/cusp_component-definition.json + cp -rp bin/openscap-plugin $HOME/.local/share/complytime/plugins + checksum=$(sha256sum $HOME/.local/share/complytime/plugins/openscap-plugin| cut -d ' ' -f 1 ) + cat > $HOME/.local/share/complytime/plugins/c2p-openscap-manifest.json << EOF + { + "metadata": { + "id": "openscap", + "description": "My openscap plugin", + "version": "0.0.1", + "types": [ + "pvp" + ] + }, + "executablePath": "openscap-plugin", + "sha256": "$checksum", + "configuration": [ + { + "name": "workspace", + "description": "Directory for writing plugin artifacts", + "required": true + }, + { + "name": "profile", + "description": "The OpenSCAP profile to run for assessment", + "required": true + }, + { + "name": "datastream", + "description": "The OpenSCAP datastream to use. If not set, the plugin will try to determine it based on system information", + "required": false + }, + { + "name": "policy", + "description": "The name of the generated tailoring file", + "default": "tailoring_policy.xml", + "required": false + }, + { + "name": "arf", + "description": "The name of the generated ARF file", + "default": "arf.xml", + "required": false + }, + { + "name": "results", + "description": "The name of the generated results file", + "default": "results.xml", + "required": false + } + ] + } + EOF + + - name: Test complyctl + run: | + ls -l + tree $HOME/.local/share/complytime/ + complyctl list