-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ansible execution environment build pipeline (#6)
feat: include pre-commit setup, secret scanning, ansible-lint, EE build and a basic sanity test
- Loading branch information
1 parent
fa6e709
commit 52639b1
Showing
23 changed files
with
2,593 additions
and
21 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*secret* | ||
node_modules/ |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
resources: | ||
- pipelines-unprivileged-sa.yaml | ||
- pipelines-unprivileged-clusterrole.yaml | ||
- pipelines-unprivileged-rb.yaml | ||
- pipelines-unprivileged-scc.yaml |
13 changes: 13 additions & 0 deletions
13
.tekton/buildah-rootless/pipelines-unprivileged-clusterrole.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: pipelines-scc-userid-1000-clusterrole | ||
rules: | ||
- apiGroups: | ||
- security.openshift.io | ||
resourceNames: | ||
- pipelines-scc-userid-1000 | ||
resources: | ||
- securitycontextconstraints | ||
verbs: | ||
- use |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: pipelines-scc-userid-1000-rolebinding | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: pipelines-scc-userid-1000-clusterrole | ||
subjects: | ||
- kind: ServiceAccount | ||
name: pipelines-sa-userid-1000 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: pipelines-sa-userid-1000 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
apiVersion: security.openshift.io/v1 | ||
kind: SecurityContextConstraints | ||
metadata: | ||
name: pipelines-scc-userid-1000 | ||
allowHostDirVolumePlugin: false | ||
allowHostIPC: false | ||
allowHostNetwork: false | ||
allowHostPID: false | ||
allowHostPorts: false | ||
allowPrivilegeEscalation: true | ||
allowPrivilegedContainer: false | ||
allowedCapabilities: null | ||
defaultAddCapabilities: null | ||
fsGroup: | ||
type: MustRunAs | ||
groups: | ||
- system:cluster-admins | ||
priority: 10 | ||
readOnlyRootFilesystem: false | ||
requiredDropCapabilities: | ||
- MKNOD | ||
- KILL | ||
runAsUser: | ||
type: MustRunAs | ||
uid: 1000 | ||
seLinuxContext: | ||
type: MustRunAs | ||
supplementalGroups: | ||
type: RunAsAny | ||
users: | ||
- pipelines-sa-userid-1000 | ||
volumes: | ||
- configMap | ||
- downwardAPI | ||
- emptyDir | ||
- persistentVolumeClaim | ||
- projected | ||
- secret |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
name: chains-config | ||
namespace: openshift-pipelines | ||
labels: | ||
app.kubernetes.io/instance: default | ||
app.kubernetes.io/part-of: tekton-chains | ||
operator.tekton.dev/operand-name: tektoncd-chains | ||
data: | ||
artifacts.oci.repository: "image-registry.openshift-image-registry.svc:5000" | ||
artifacts.oci.storage: "tekton,oci" | ||
artifacts.pipelinerun.format: slsa/v1 | ||
artifacts.pipelinerun.storage: "tekton,oci" | ||
artifacts.taskrun.format: slsa/v1 | ||
artifacts.taskrun.storage: "tekton,oci" | ||
transparency.enabled: "true" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: registry-credentials | ||
annotations: | ||
tekton.dev/docker-0: quay.io | ||
tekton.dev/docker-1: registry.redhat.io | ||
stringData: | ||
config.json: | | ||
{your-auth} | ||
type: kubernetes.io/dockerconfigjson |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Task | ||
metadata: | ||
name: ansible-builder-create | ||
labels: | ||
app.kubernetes.io/version: "0.1" | ||
annotations: | ||
tekton.dev/pipelines.minVersion: "0.37.4" | ||
tekton.dev/displayName: ansible-builder | ||
tekton.dev/categories: Build Tools | ||
tekton.dev/tags: ansible, ansible-builder, build-tool, automation | ||
tekton.dev/platforms: "linux/amd64" | ||
spec: | ||
description: >- | ||
Creates a build context (including a Containerfile) from an execution environment spec. | ||
This build context is populated with dependencies including requirements files. | ||
workspaces: | ||
- name: source | ||
description: The source workspace where the execution environment code is cloned. | ||
params: | ||
- description: Execution environment file definition. | ||
name: FILENAME | ||
type: string | ||
default: execution-environment.yml | ||
- description: Execution environment build context. | ||
name: BUILD_CONTEXT | ||
type: string | ||
default: "." | ||
- name: OUTPUT_FILENAME | ||
description: Name of file to write image definition to. Either Dockerfile or Containerfile. | ||
type: string | ||
default: Containerfile | ||
- description: ansible-builder output verbosity. | ||
name: VERBOSITY | ||
type: string | ||
default: "2" | ||
- name: BUILDER_IMAGE | ||
description: The location of the ansible-builder image. | ||
type: string | ||
default: quay.io/ansible/ansible-builder:latest | ||
- name: PATH | ||
type: string | ||
default: "." | ||
steps: | ||
- name: ansible-builder-create | ||
workingDir: $(workspaces.source.path)/$(params.PATH) | ||
image: $(params.BUILDER_IMAGE) | ||
env: | ||
- name: HOME | ||
value: /tekton/home | ||
securityContext: | ||
runAsNonRoot: true | ||
runAsUser: 65532 | ||
script: | | ||
#!/bin/sh | ||
set -eux -o | ||
ansible-builder create -f "$(params.FILENAME)" -c "$(params.BUILD_CONTEXT)" --output-filename "$(params.OUTPUT_FILENAME)" -v "$(params.VERBOSITY)" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Task | ||
metadata: | ||
name: ansible-ee-sanity-test | ||
labels: | ||
app.kubernetes.io/version: "0.1" | ||
annotations: | ||
tekton.dev/pipelines.minVersion: "0.37.4" | ||
tekton.dev/categories: Image Test | ||
tekton.dev/tags: image-test | ||
spec: | ||
description: A task for testing the built ansible execution environment. | ||
params: | ||
- name: IMAGE | ||
type: string | ||
description: The name of the image to be tested. | ||
- name: TAG | ||
type: string | ||
description: Tag of the image tp be tested. | ||
- name: CONTEXT | ||
type: string | ||
description: Path to the directory to use as context. | ||
default: . | ||
- name: EXTRA_ARGS | ||
description: Extra parameters passed for the build command when building images. | ||
default: "" | ||
workspaces: | ||
- name: source | ||
|
||
steps: | ||
- name: test-image | ||
image: $(params.IMAGE):$(params.TAG) | ||
workingDir: $(workspaces.source.path) | ||
script: | | ||
#!/usr/bin/env sh | ||
cat /etc/os-release | ||
cat /etc/hosts | ||
pip3 list | ||
rpm -qa | ||
ansible-galaxy collection list | ||
yamllint --version | ||
ansible-lint --version | ||
ansible-playbook --version |
Oops, something went wrong.