-
Notifications
You must be signed in to change notification settings - Fork 11
OKD-152: Add layered build for OKD-SCOS #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
40e9d97
845b51d
6efeae5
a8c250c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
apiVersion: security.openshift.io/v1 | ||
kind: SecurityContextConstraints | ||
metadata: | ||
name: scc-admin | ||
allowHostDirVolumePlugin: false | ||
allowHostIPC: false | ||
allowHostNetwork: false | ||
allowHostPID: false | ||
allowHostPorts: false | ||
allowPrivilegeEscalation: true | ||
allowPrivilegedContainer: true | ||
allowedCapabilities: null | ||
defaultAddCapabilities: null | ||
fsGroup: | ||
type: RunAsAny | ||
groups: [] | ||
priority: null | ||
readOnlyRootFilesystem: false | ||
requiredDropCapabilities: | ||
- KILL | ||
- MKNOD | ||
- SYS_CHROOT | ||
runAsUser: | ||
type: RunAsAny | ||
seLinuxContext: | ||
type: RunAsAny | ||
supplementalGroups: | ||
type: RunAsAny | ||
users: | ||
- system:serviceaccount:okd-coreos:pipeline | ||
volumes: | ||
- awsElasticBlockStore | ||
- azureDisk | ||
- azureFile | ||
- cephFS | ||
- cinder | ||
- configMap | ||
- csi | ||
- downwardAPI | ||
- emptyDir | ||
- ephemeral | ||
- fc | ||
- flexVolume | ||
- flocker | ||
- gcePersistentDisk | ||
- gitRepo | ||
- glusterfs | ||
- iscsi | ||
- nfs | ||
- persistentVolumeClaim | ||
- photonPersistentDisk | ||
- portworxVolume | ||
- projected | ||
- quobyte | ||
- rbd | ||
- scaleIO | ||
- secret | ||
- storageOS | ||
- vsphere |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Task | ||
metadata: | ||
name: build-layer | ||
spec: | ||
steps: | ||
- image: quay.io/podman/stable:latest | ||
name: build-layer | ||
resources: {} | ||
securityContext: | ||
privileged: true | ||
script: | | ||
#!/usr/bin/env bash | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this Task be separated in future and run in a separate pipeline (like the 'future' payload one, as we can do for okd/fcos) and maintain the coreos pipeline to only build the base os? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, it's definitely the plan to buid base and layer(s) separately! |
||
set -euxo pipefail | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: whitespaces |
||
dnf install -y jq | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: whitespaces |
||
cd /srv/coreos | ||
|
||
OSTREE_VERSION=$(jq -r '."ostree-version"' < builds/latest/$(uname -m)/meta.json) | ||
OSTREE_TARFILE=$(jq -r '.images.ostree.path' < builds/latest/$(uname -m)/meta.json) | ||
|
||
# the c9s.repo file is meant to be consumed by a COSA container | ||
# where the RPM GPG keys are shipped in /usr/share/distribution-gpg-keys/centos | ||
# SCOS however ships the keys in the /etc/pki/rpm-gpg | ||
sed -i 's;/usr/share/distribution-gpg-keys/centos;/etc/pki/rpm-gpg;g' src/config/c9s.repo | ||
sed -i 's/RPM-GPG-KEY-CentOS-Official/RPM-GPG-KEY-centosofficial/g' src/config/c9s.repo | ||
|
||
cat <<EOF >> src/config/Dockerfile | ||
FROM quay.io/okd/centos-stream-coreos-9:4.14-x86_64 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might be nice as a parameter |
||
COPY rpms/ /srv/coreos/rpms/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be |
||
COPY src/config/c9s.repo /etc/yum.repos.d/c9s.repo | ||
COPY src/config/packages-openshift.yaml /etc/rpm-ostree/origin.d/packages-openshift.yaml | ||
RUN cat /etc/os-release \ | ||
&& rpm-ostree --version \ | ||
&& ostree --version \ | ||
&& rpm-ostree ex rebuild \ | ||
&& rpm-ostree cleanup -m \ | ||
&& rm -rf /var/lib/unbound /srv/coreos/rpms /etc/rpm-ostree/origin.d /etc/yum.repos.d/c9s.repo \ | ||
&& ostree container commit | ||
|
||
LABEL io.openshift.release.operator=true \ | ||
io.openshift.build.version-display-names="machine-os=CentOS Stream CoreOS" \ | ||
io.openshift.build.versions="machine-os=${OSTREE_VERSION}" | ||
|
||
EOF | ||
|
||
ls /srv/coreos/builds/latest/$(uname -m)/${OSTREE_TARFILE} | ||
podman build \ | ||
-f src/config/Dockerfile \ | ||
-t ostree-okd \ | ||
. | ||
# mkdir /srv/ostree-okd | ||
podman save --format oci-dir ostree-okd:latest -o /srv/ostree-okd | ||
# podman tag localhost/ostree-okd quay.io/okd/stream-coreos-okd | ||
# podman push quay.io/okd/stream-coreos-okd | ||
# TODO Allow for pulling previously built base image, and for pushing the layered image | ||
printf "%s" "OK" > $(results.output.path) | ||
results: | ||
- name: output | ||
workspaces: | ||
- mountPath: /srv | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency with 067ce9d we should use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And, replace all the references of |
||
name: ws |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Task | ||
metadata: | ||
name: cosa-push-layered-container | ||
spec: | ||
params: | ||
- name: target-registry | ||
default: quay.io/okd | ||
type: string | ||
- name: container-image-name | ||
default: stream-coreos-okd | ||
type: string | ||
- name: image | ||
default: localhost/ostree-okd | ||
type: string | ||
- name: tag | ||
default: "4.14" | ||
type: string | ||
- name: tag-latest | ||
default: "false" | ||
type: string | ||
steps: | ||
- image: 'quay.io/podman/stable:latest' | ||
name: upload-image | ||
resources: {} | ||
securityContext: | ||
privileged: true | ||
script: | | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
|
||
cd /srv/coreos | ||
podman images | ||
podman load -i /srv/ostree-okd | ||
podman tag ostree-okd:latest $(params.target-registry)/$(params.container-image-name):$(params.tag)-$(uname -m) | ||
podman push $(params.target-registry)/$(params.container-image-name):$(params.tag)-$(uname -m) --authfile=$(workspaces.regcred.path)/.dockerconfigjson | ||
# cosa push-container --authfile=$(workspaces.regcred.path)/.dockerconfigjson --image=$(params.image) $(params.target-registry)/$(params.container-image-name) | ||
# if [[ "$(params.tag-latest)" == "true" ]]; then | ||
# # Add stable tag for import into Prow | ||
# cosa push-container --authfile=$(workspaces.regcred.path)/.dockerconfigjson --image=$(params.image) $(params.target-registry)/$(params.container-image-name):$(params.tag)-$(uname -m) | ||
# fi | ||
|
||
workspaces: | ||
- name: regcred | ||
- mountPath: /srv | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
name: ws |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should run the
build-layer
task aftercosa-test
andcosa-upload-baseos
in order to pull the freshlybaseos
built duringcosa-build-baseos
task of the current pipeline. Otherwise, we would pull thebaseos
image from the latest pipeline run