Repository: kubernetes-sigs/security-profiles-operator
Pull request #217 (2021-01-21 17:01:16)

codecov for tracking codecoverage tracking

#### What type of PR is this?
To track code coverage across PR's.



#### What this PR does / why we need it:
To help increase the code coverage and track coverage across.

#### Which issue(s) this PR fixes:

None


#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?

NONE

```release-note
NONE
```


k8s-ci-robot: @naveensrinivasan: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our [release note process](https://git.k8s.io/community/contributors/guide/release-notes.md) to remove it.

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
</details>
k8s-ci-robot: Hi @naveensrinivasan. Thanks for your PR.

I'm waiting for a [kubernetes-sigs](https://github.com/orgs/kubernetes-sigs/people) member to verify that this patch is reasonable to test. If it is, they should reply with `/ok-to-test` on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should [join the org](https://git.k8s.io/community/community-membership.md#member) to skip this step.

Once the patch is verified, the new status will be reflected by the `ok-to-test` label.

I understand the commands that are listed [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fsecurity-profiles-operator).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
</details>

k8s-ci-robot: [APPROVALNOTIFIER] This PR is **NOT APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubernetes-sigs/security-profiles-operator/pull/217#" title="Author self-approved">naveensrinivasan</a>*
To complete the [pull request process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process), please assign **pjbgf** after the PR has been reviewed.
You can assign the PR to them by writing `/assign @pjbgf` in a comment when ready.

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fsecurity-profiles-operator).

<details open>
Needs approval from an approver in each of these files:

- **[OWNERS](https://github.com/kubernetes-sigs/security-profiles-operator/blob/master/OWNERS)**

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":["pjbgf"]} -->
k8s-ci-robot: @naveensrinivasan: PR needs rebase.

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
</details>
JAORMX: /ok-to-test

Patch:
diff --git a/.codecov.yml b/.codecov.yml
new file mode 100644
index 000000000..df2db6cb5
--- /dev/null
+++ b/.codecov.yml
@@ -0,0 +1,33 @@
+---
+codecov:
+  notify:
+    after_n_builds: 1
+    require_ci_to_pass: false
+
+coverage:
+  precision: 2
+  round: down
+  range: 50..75
+
+  status:
+    project:
+      default:
+        enabled: true
+        # allowed to drop coverage and still result in a "success" commit status
+        threshold: null
+        if_not_found: success
+        if_no_uploads: success
+        if_ci_failed: error
+    patch:
+      default:
+        enabled: true
+        threshold: null
+        if_not_found: success
+        if_no_uploads: success
+        if_ci_failed: error
+    changes: false
+
+comment:
+  layout: "header, diff"
+  behavior: default
+  require_changes: false
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 919b9de17..283e71de2 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -40,6 +40,12 @@ or
 None
 -->
 
+#### Does this PR have test?
+
+<!--
+If tests aren't applicable just write N/A.
+-->
+
 #### Special notes for your reviewer:
 
 #### Does this PR introduce a user-facing change?
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 32d65f323..8aecc29f0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,4 +1,4 @@
-name: build
+name: macosbuild
 on: [push, pull_request]
 jobs:
   validate:
diff --git a/Makefile b/Makefile
index 31bcf452a..96cadc539 100644
--- a/Makefile
+++ b/Makefile
@@ -154,6 +154,9 @@ $(BUILD_DIR)/golangci-lint:
 
 .PHONY: test-unit
 test-unit: $(BUILD_DIR) ## Run the unit tests
+	# remove all coverage files if exists
+	rm -rf *.out
+	# run the go tests and gen the file coverage-all used to do the integration with coverrals.io
 	$(GO) test -ldflags '$(LDVARS)' -tags '$(BUILDTAGS)' -race -v -test.coverprofile=$(BUILD_DIR)/coverage.out ./internal/...
 	$(GO) tool cover -html $(BUILD_DIR)/coverage.out -o $(BUILD_DIR)/coverage.html
 
@@ -197,6 +200,9 @@ push-openshift-dev: set-openshift-image-params openshift-user image
 
 .PHONY: do-deploy-openshift-dev
 do-deploy-openshift-dev:
+	@echo "Deploying cert-manager"
+	oc apply -f https://github.com/jetstack/cert-manager/releases/download/v1.1.0/cert-manager.yaml
+	oc wait --for=condition=Ready pod -lapp.kubernetes.io/instance=cert-manager -ncert-manager
 	@echo "Building custom operator.yaml"
 	kustomize build --reorder=none deploy/overlays/openshift-dev -o deploy/operator.yaml
 	@echo "Deploying"
@@ -207,5 +213,5 @@ do-deploy-openshift-dev:
 	git checkout deploy/operator.yaml
 
 # Deploy for development into OpenShift
-.PHONY: dev-deploy-openshift
+.PHONY: deploy-openshift-dev
 deploy-openshift-dev: push-openshift-dev do-deploy-openshift-dev
diff --git a/deploy/overlays/openshift-dev/enable-selinux.yaml b/deploy/overlays/openshift-dev/enable-selinux.yaml
new file mode 100644
index 000000000..b98c52f89
--- /dev/null
+++ b/deploy/overlays/openshift-dev/enable-selinux.yaml
@@ -0,0 +1,3 @@
+- op: replace
+  path: /data/EnableSelinux
+  value: "true"
diff --git a/deploy/overlays/openshift-dev/kustomization.yaml b/deploy/overlays/openshift-dev/kustomization.yaml
index b4f2b1bd4..dfbaa0e77 100644
--- a/deploy/overlays/openshift-dev/kustomization.yaml
+++ b/deploy/overlays/openshift-dev/kustomization.yaml
@@ -12,6 +12,11 @@ patchesJson6902:
       kind: ConfigMap
       name: security-profiles-operator-profile
     path: operator-profile.yaml
+  - target:
+      version: v1
+      kind: ConfigMap
+      name: config
+    path: enable-selinux.yaml
 
 images:
   - name: gcr.io/k8s-staging-sp-operator/security-profiles-operator


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 000000000..c90a77ce7
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,28 @@
+# Inlcuding the tests with ubuntu to get actual test coverage. The OSX builds skip seccomp tests.
+name: test-coverage
+on:
+  push:
+    branches:
+      - master
+  pull_request:
+jobs:
+  validate:
+    name: Validate 
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - name: Setup Go
+        uses: actions/setup-go@v2
+        with:
+          go-version: '1.15'
+      - name: Install libseccomp-dev
+        run: |
+          sudo apt update
+          sudo apt install -y libseccomp-dev
+      - name: unit test
+        run: make test-unit
+      - uses: codecov/codecov-action@v1
+        with:
+          files: build/coverage.out
+          flags: unittests 
+          verbose: true