Repository: osbuild/osbuild-composer
Pull request #2043 (2021-11-19 12:25:23)

Improve contributing.md
use auto-answer -y for all commands
mention the script tools/prepare-source
mention the go generate step


This pull request includes:

- [ ] adequate testing for the new functionality or fixed issue
- [ ] adequate documentation informing people about the change such as
  - [ ] submit a PR for the [guides](https://github.com/osbuild/guides) repository if this PR changed any behavior described there: https://www.osbuild.org/guides/

<!--
Thanks for proposing a change to osbuild-composer!

Please don't remove the above check list. These are things that each pull
request must have before it is merged. It helps maintainers to not forget
anything.

If the reason for ticking any of the boxes is ambiguous, please add a short
note explaining why.

In addition, if this pull request fixes a downstream issue, please refer to
test/README.md and add these additional items:

- [ ] 1st commit of any `rhbz#` related PR contains bug reproducer; CI reports FAIL or
- [ ] PR contains automated tests for new functionality and
- [ ] QE has approved reproducer/new tests and
- [ ] Subsequent commits provide bug fixes without modifying the reproducer; CI reports PASS and
- [ ] QE approves this PR; RHBZ status is set to `MODIFIED + Verified=Tested`
-->



Patch:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 468561c62..646dc337e 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -21,8 +21,8 @@ $ cd osbuild-composer
 2. To install the build-requirements for Fedora and friends, use:
 
 ```
-$ sudo dnf group install 'RPM Development Tools'   # Install rpmbuild
-$ sudo dnf builddep osbuild-composer.spec          # Install build-time dependencies
+$ sudo dnf group install -y 'RPM Development Tools'   # Install rpmbuild
+$ sudo dnf builddep -y osbuild-composer.spec          # Install build-time dependencies
 $ sudo dnf -y install cockpit-composer             # Optional: Install cockpit integration
 $ sudo systemctl start cockpit.socket              # Optional: Start cockpit
 ```
@@ -44,12 +44,13 @@ Alternatively you can use `composer-cli` to interact with the Weldr API. We
 don't have any client for the RCM API, so the only option there is a
 plain `curl`.
 
-When developing the code, use `go` executable to build, run, and test you
-code [1]:
+When developing the code, use `go` executable to generate, build, run, and test you
+code [1], alternatively you can use the script `tools/prepare-source.sh`:
 
 ```
 $ go test ./...
 $ go build ./...
+$ go generate ./...
 $ go run ./cmd/osbuild-pipeline/
 ```
 
diff --git a/internal/osbuild2/selinux_stage.go b/internal/osbuild2/selinux_stage.go
index 37377d86f..4757283bc 100644
--- a/internal/osbuild2/selinux_stage.go
+++ b/internal/osbuild2/selinux_stage.go
@@ -5,8 +5,9 @@ package osbuild2
 // A file contexts configuration file is sepcified that describes
 // the filesystem labels to apply to the image.
 type SELinuxStageOptions struct {
-	FileContexts string            `json:"file_contexts"`
-	Labels       map[string]string `json:"labels,omitempty"`
+	FileContexts     string            `json:"file_contexts"`
+	Labels           map[string]string `json:"labels,omitempty"`
+	ForceAutorelabel *bool             `json:"force_autorelabel,omitempty"`
 }
 
 func (SELinuxStageOptions) isStageOptions() {}


Test patch:
diff --git a/internal/osbuild2/stage_test.go b/internal/osbuild2/stage_test.go
index e31b96d5a..a9d8e3bfa 100644
--- a/internal/osbuild2/stage_test.go
+++ b/internal/osbuild2/stage_test.go
@@ -452,6 +452,18 @@ func TestStage_UnmarshalJSON(t *testing.T) {
 				data: []byte(`{"type":"org.osbuild.selinux","options":{"file_contexts":""}}`),
 			},
 		},
+		{
+			name: "selinux-force_autorelabel",
+			fields: fields{
+				Type: "org.osbuild.selinux",
+				Options: &SELinuxStageOptions{
+					ForceAutorelabel: common.BoolToPtr(true),
+				},
+			},
+			args: args{
+				data: []byte(`{"type":"org.osbuild.selinux","options":{"file_contexts":"","force_autorelabel":true}}`),
+			},
+		},
 		{
 			name: "selinux.config-empty",
 			fields: fields{