Skip to content

Instantly share code, notes, and snippets.

@alaypatel07
Last active May 9, 2022 14:49
Show Gist options
  • Save alaypatel07/108fa491a94026dd9ea2a0bf22163146 to your computer and use it in GitHub Desktop.
Save alaypatel07/108fa491a94026dd9ea2a0bf22163146 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"k8s.io/test-infra/prow/apis/prowjobs/v1"
"sigs.k8s.io/yaml"
)
func main() {
data := `metadata:
annotations:
prow.k8s.io/context: ""
prow.k8s.io/job: periodic-ci-openshift-oadp-operator-master-4.10-operator-e2e-aws-periodic-slack
creationTimestamp: "2022-05-06T04:00:21Z"
generation: 7
labels:
ci-operator.openshift.io/cloud: aws
ci-operator.openshift.io/cloud-cluster-profile: aws
ci-operator.openshift.io/variant: "4.10"
ci.openshift.io/generator: prowgen
created-by-prow: "true"
pj-rehearse.openshift.io/can-be-rehearsed: "true"
prow.k8s.io/build-id: "1522426013835857920"
prow.k8s.io/context: ""
prow.k8s.io/id: 0c65db6e-ccf1-11ec-a5f5-0a580a80285f
prow.k8s.io/job: periodic-ci-openshift-oadp-operator-master-4.10-operator-e2e-aw
prow.k8s.io/refs.base_ref: master
prow.k8s.io/refs.org: openshift
prow.k8s.io/refs.repo: oadp-operator
prow.k8s.io/type: periodic
name: 0c65db6e-ccf1-11ec-a5f5-0a580a80285f
namespace: ci
resourceVersion: "1972933621"
uid: e6767568-0f97-43bb-91e5-274407ce05fe
spec:
agent: kubernetes
cluster: build04
decoration_config:
censor_secrets: true
gcs_configuration:
bucket: origin-ci-test
default_org: openshift
default_repo: origin
mediaTypes:
log: text/plain
path_strategy: single
gcs_credentials_secret: gce-sa-credentials-gcs-publisher
grace_period: 1h0m0s
resources:
clonerefs:
limits:
memory: 3Gi
requests:
cpu: 100m
memory: 500Mi
initupload:
limits:
memory: 200Mi
requests:
cpu: 100m
memory: 50Mi
place_entrypoint:
limits:
memory: 100Mi
requests:
cpu: 100m
memory: 25Mi
sidecar:
limits:
memory: 2Gi
requests:
cpu: 100m
memory: 250Mi
skip_cloning: true
timeout: 4h0m0s
utility_images:
clonerefs: gcr.io/k8s-prow/clonerefs:v20220505-0f136d5f37
entrypoint: gcr.io/k8s-prow/entrypoint:v20220505-0f136d5f37
initupload: gcr.io/k8s-prow/initupload:v20220505-0f136d5f37
sidecar: gcr.io/k8s-prow/sidecar:v20220505-0f136d5f37
extra_refs:
- base_ref: master
org: openshift
repo: oadp-operator
job: periodic-ci-openshift-oadp-operator-master-4.10-operator-e2e-aws-periodic-slack
namespace: ci
pod_spec:
containers:
- args:
- --gcs-upload-secret=/secrets/gcs/service-account.json
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
- --lease-server-credentials-file=/etc/boskos/credentials
- --report-credentials-file=/etc/report/credentials
- --secret-dir=/secrets/ci-pull-credentials
- --secret-dir=/usr/local/operator-e2e-aws-periodic-slack-cluster-profile
- --target=operator-e2e-aws-periodic-slack
- --variant=4.10
command:
- ci-operator
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources:
requests:
cpu: 10m
volumeMounts:
- mountPath: /etc/boskos
name: boskos
readOnly: true
- mountPath: /secrets/ci-pull-credentials
name: ci-pull-credentials
readOnly: true
- mountPath: /usr/local/operator-e2e-aws-periodic-slack-cluster-profile
name: cluster-profile
- mountPath: /secrets/gcs
name: gcs-credentials
readOnly: true
- mountPath: /etc/pull-secret
name: pull-secret
readOnly: true
- mountPath: /etc/report
name: result-aggregator
readOnly: true
serviceAccountName: ci-operator
volumes:
- name: boskos
secret:
items:
- key: credentials
path: credentials
secretName: boskos-credentials
- name: ci-pull-credentials
secret:
secretName: ci-pull-credentials
- name: cluster-profile
secret:
secretName: cluster-secrets-aws
- name: pull-secret
secret:
secretName: registry-pull-credentials
- name: result-aggregator
secret:
secretName: result-aggregator
prowjob_defaults:
tenant_id: GlobalDefaultID
report: true
type: periodic
status:
build_id: "1522426013835857920"
completionTime: "2022-05-06T05:20:42Z"
description: Job succeeded.
pendingTime: "2022-05-06T04:00:21Z"
pod_name: 0c65db6e-ccf1-11ec-a5f5-0a580a80285f
prev_report_states:
gcsk8sreporter: success
gcsreporter: success
startTime: "2022-05-06T04:00:20Z"
state: success
url: https://prow.ci.openshift.org/view/gs/origin-ci-test/logs/periodic-ci-openshift-oadp-operator-master-4.10-operator-e2e-aws-periodic-slack/1522426013835857920
`
prow := v1.ProwJob{}
err := yaml.Unmarshal([]byte(data), &prow)
if err != nil {
println("time pass")
return
}
fmt.Println(prow.Spec.PodSpec.Containers[0].Args)
}
@alaypatel07
Copy link
Author

The output with above snippet is as follows:

[--gcs-upload-secret=/secrets/gcs/service-account.json --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson --lease-server-credentials-file=/etc/boskos/credentials --report-credentials-file=/etc/report/credentials --secret-dir=/secrets/ci-pull-credentials --secret-dir=/usr/local/operator-e2e-aws-periodic-slack-cluster-profile --target=operator-e2e-aws-periodic-slack --variant=4.10]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment