Skip to content

[4.8] Generate ci-operator configs and jobs#12621

Merged
openshift-merge-robot merged 4 commits into
openshift:masterfrom
petr-muller:4.8-ci-op-configs
Oct 13, 2020
Merged

[4.8] Generate ci-operator configs and jobs#12621
openshift-merge-robot merged 4 commits into
openshift:masterfrom
petr-muller:4.8-ci-op-configs

Conversation

@petr-muller
Copy link
Copy Markdown
Member

#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

git fetch upstream
git reset --hard upstream/master

config-brancher --config-dir ci-operator/config --current-release=4.7 --future-release=4.8 --confirm
git add ci-operator/config
git commit -m "[4.8] Generate ci-operator configuration" -m '```console
$ config-brancher --config-dir ci-operator/config --current-release=4.7 --future-release=4.8 --confirm
```'

ci-operator-config-mirror --config-path ci-operator/config --to-org openshift-priv
git add ci-operator/config
git commit -m "[4.8] Generate ci-operator configuration for openshift-priv" -m '```console
$ ci-operator-config-mirror --config-path ci-operator/config --to-org openshift-priv
```'

cat <<EOF >/tmp/filter.py
#!/usr/bin/env python3

import yaml
import sys
import copy

with open(sys.argv[1]) as f:
    all = yaml.full_load(f)
    for t in ("presubmits", "postsubmits"):
        for repo in all.get(t, {}):
            pruned = []
            for job in all.get(t, {}).get(repo, []):
                if job.get("agent", "") == "kubernetes":
                    pruned.append(job)
            all[t][repo] = pruned

with open(sys.argv[1], 'w') as f:
    yaml.dump(all, f, default_flow_style=False)
EOF

chmod +x /tmp/filter.py

find ci-operator/jobs/ -name '*-release-4.7-*submits.yaml' -or -name '*-release-4.7-periodics.yaml' | while read -r item; do
    echo -n "Processing: ${item}"
    cp "${item}" "${item/4.7/4.8}"
    sed -i 's/-release-4.7-/-release-4.8-/g' "${item/4.7/4.8}" # job names
    sed -i 's/- release-4.7/- release-4.8/g' "${item/4.7/4.8}" # branches
    /tmp/filter.py "${item/4.7/4.8}"
    echo " [DONE]"
done

# openshift/release are special and are handled separately
rm -f ci-operator/jobs/openshift/release/openshift-release-release-4.8-periodics.yaml
git add ci-operator/jobs
git commit -m "[4.8] Prepopulate jobs by copying 4.7 ones" -m '```console
$ cat <<EOF >/tmp/filter.py
#!/usr/bin/env python3

import yaml
import sys
import copy

with open(sys.argv[1]) as f:
    all = yaml.full_load(f)
    for t in ("presubmits", "postsubmits"):
        for repo in all.get(t, {}):
            pruned = []
            for job in all.get(t, {}).get(repo, []):
                if job.get("agent", "") == "kubernetes":
                    pruned.append(job)
            all[t][repo] = pruned

with open(sys.argv[1], '\''w'\'') as f:
    yaml.dump(all, f, default_flow_style=False)
EOF

$ chmod +x /tmp/filter.py

$ find ci-operator/jobs/ -name '\''*-release-4.7-*submits.yaml'\'' -or -name '\''*-release-4.7-periodics.yaml'\'' | while read -r item; do
    cp "${item}" "${item/4.7/4.8}"
    sed -i '\''s/-release-4.7-/-release-4.8-/g'\'' "${item/4.7/4.8}" # job names
    sed -i '\''s/- release-4.7/- release-4.8/g'\'' "${item/4.7/4.8}" # branches
    /tmp/filter.py "${item/4.7/4.8}"
    echo " [DONE]"
$ done
```
'

make jobs
git add ci-operator/jobs
git commit -m "[4.8] Fixup prepopulated jobs with make jobs" -m '```console
$ make jobs
```
'

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 9, 2020
@petr-muller
Copy link
Copy Markdown
Member Author

/test release-controller-config

@petr-muller
Copy link
Copy Markdown
Member Author

/uncc JAORMX derekwaynecarr
/cc @openshift/openshift-team-developer-productivity-test-platform

@openshift-ci-robot openshift-ci-robot requested review from a team and removed request for JAORMX and derekwaynecarr October 9, 2020 13:35
@petr-muller
Copy link
Copy Markdown
Member Author

 Traceback (most recent call last):
  File ".//hack/generators/release-controllers/generate-release-controllers.py", line 151, in <module>
    run(sys.argv[1])
  File ".//hack/generators/release-controllers/generate-release-controllers.py", line 118, in run
    content.add_rpm_mirror_service(gendoc, git_clone_dir, major_minor)
  File "/home/prow/go/src/github.com/openshift/release/hack/generators/lib/genlib/__init__.py", line 109, in __exit__
    raise IOError('No resources added to document')
OSError: No resources added to document 

Not exactly helpful :/

@petr-muller
Copy link
Copy Markdown
Member Author

The ci/prow/release-controller-config is caused by us not having prepared release-controller content first.

```console
$ config-brancher --config-dir ci-operator/config --current-release=4.7 --future-release=4.8 --confirm
```
```console
$ ci-operator-config-mirror --config-path ci-operator/config --to-org openshift-priv
```
```console
$ cat <<EOF >/tmp/filter.py
#!/usr/bin/env python3

import yaml
import sys
import copy

with open(sys.argv[1]) as f:
    all = yaml.full_load(f)
    for t in ("presubmits", "postsubmits"):
        for repo in all.get(t, {}):
            pruned = []
            for job in all.get(t, {}).get(repo, []):
                if job.get("agent", "") == "kubernetes":
                    pruned.append(job)
            all[t][repo] = pruned

with open(sys.argv[1], 'w') as f:
    yaml.dump(all, f, default_flow_style=False)
EOF

$ chmod +x /tmp/filter.py

$ find ci-operator/jobs/ -name '*-release-4.7-*submits.yaml' -or -name '*-release-4.7-periodics.yaml' | while read -r item; do
    cp "${item}" "${item/4.7/4.8}"
    sed -i 's/-release-4.7-/-release-4.8-/g' "${item/4.7/4.8}" # job names
    sed -i 's/- release-4.7/- release-4.8/g' "${item/4.7/4.8}" # branches
    /tmp/filter.py "${item/4.7/4.8}"
    echo " [DONE]"
$ done
```
@stevekuznetsov
Copy link
Copy Markdown
Contributor

/lgtm
/approve
/hold cancel

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 13, 2020
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: petr-muller, stevekuznetsov

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants