|
4 | 4 | workflow_dispatch: {} |
5 | 5 | push: |
6 | 6 | branches: |
7 | | - - release-v1.15.x |
| 7 | + - release-v1.15.x |
8 | 8 | paths: |
9 | | - - .github/workflows/update-sources.yaml |
| 9 | + - .github/workflows/update-sources.yaml |
10 | 10 | jobs: |
11 | 11 | update-sources: |
| 12 | + # This line prevents the job from running if CodeFreeze is true |
| 13 | + if: true |
12 | 14 | runs-on: ubuntu-latest |
13 | 15 | permissions: |
14 | 16 | contents: write |
15 | 17 | pull-requests: write |
16 | 18 | steps: |
17 | | - - name: Checkout the current repo |
18 | | - uses: actions/checkout@v4 |
19 | | - with: |
20 | | - ref: release-v1.15.x |
| 19 | + - name: Checkout the current repo |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + ref: release-v1.15.x |
21 | 23 |
|
22 | | - - name: Clone tektoncd-catalog/git-clone |
23 | | - run: | |
24 | | - rm -fR upstream |
25 | | - git clone https://github.com/tektoncd-catalog/git-clone upstream |
26 | | - pushd upstream |
27 | | - git checkout -B release-v1.0.x origin/release-v1.0.x |
28 | | - popd |
29 | | - - name: Commit new changes |
30 | | - run: | |
| 24 | + - name: Clone tektoncd-catalog/git-clone |
| 25 | + run: | |
| 26 | + rm -fR upstream |
| 27 | + git clone https://github.com/tektoncd-catalog/git-clone upstream |
| 28 | + pushd upstream |
| 29 | + git checkout -B release-v1.0.x origin/release-v1.0.x |
| 30 | + popd |
| 31 | + - name: update-rpms |
| 32 | + continue-on-error: true |
| 33 | + run: | |
| 34 | + set -x |
| 35 | + export BASE_IMAGE=$(grep -h "RUNTIME=" .konflux/dockerfiles/* | sed -E 's/.*RUNTIME=["'\'']?([^"'\'' ]+).*/\1/' | head -n 1) |
| 36 | + docker run --rm\ |
| 37 | + -e BASE_IMAGE=$BASE_IMAGE \ |
| 38 | + -v ./.konflux/rpms/:/rpms -w /rpms $BASE_IMAGE sh -c " |
| 39 | + cp -f /etc/yum.repos.d/*.repo ./ |
| 40 | + sed -i 's/^\[ubi-9-/\[ubi-9-for-\$basearch-/' *.repo |
| 41 | + " |
| 42 | + docker run --rm\ |
| 43 | + -e BASE_IMAGE=$BASE_IMAGE \ |
| 44 | + -v ./.konflux/rpms/:/rpms -w /rpms registry.access.redhat.com/ubi9/ubi-minimal:latest sh -c " |
| 45 | + microdnf update -y && microdnf install -y python3-dnf skopeo pip |
| 46 | + python3 -m pip install https://github.com/konflux-ci/rpm-lockfile-prototype/archive/refs/tags/v0.21.0.tar.gz |
| 47 | + rpm-lockfile-prototype --image $BASE_IMAGE rpms.in.yaml |
| 48 | + " |
| 49 | + - name: Commit new changes |
| 50 | + run: | |
31 | 51 | |
32 | | - set -x |
| 52 | + set -x |
33 | 53 | |
34 | | - git config user.name openshift-pipelines-bot |
35 | | - git config user.email pipelines-extcomm@redhat.com |
36 | | - git checkout -b actions/update/sources-release-v1.15.x |
37 | | - touch head |
38 | | - pushd upstream |
39 | | - OLD_COMMIT=$(cat ../head) |
40 | | - NEW_COMMIT=$(git rev-parse HEAD) |
41 | | - echo Previous commit: ${OLD_COMMIT} |
42 | | - git show --stat ${OLD_COMMIT} |
43 | | - echo New commit: ${NEW_COMMIT} |
44 | | - git show --stat ${NEW_COMMIT} |
45 | | - git diff --stat ${NEW_COMMIT}..${OLD_COMMIT} > /tmp/diff.txt |
46 | | - git rev-parse HEAD > ../head |
47 | | - popd |
48 | | - rm -rf upstream/.git |
49 | | - git add -f upstream head .konflux |
50 | | -
|
51 | | - if [[ -z $(git status --porcelain --untracked-files=no) ]]; then |
52 | | - echo "No change, exiting" |
53 | | - exit 0 |
54 | | - fi |
55 | | -
|
56 | | - git commit -F- <<EOF |
57 | | - [bot] Update release-v1.15.x from tektoncd-catalog/git-clone to ${NEW_COMMIT} |
58 | | -
|
59 | | - $ git diff --stat ${NEW_COMMIT}..${OLD_COMMIT} |
60 | | - $(cat /tmp/diff.txt | sed 's/^/ /' | head -c 55555) |
61 | | - |
62 | | - https://github.com/tektoncd-catalog/git-clone/compare/${NEW_COMMIT}..${OLD_COMMIT} |
63 | | - EOF |
64 | | - |
65 | | - git push -f origin actions/update/sources-release-v1.15.x |
66 | | -
|
67 | | - if [ "$(gh pr list --base release-v1.15.x --head actions/update/sources-release-v1.15.x --json url --jq 'length')" = "0" ]; then |
68 | | - echo "creating PR..." |
69 | | - gh pr create -B release-v1.15.x -H actions/update/sources-release-v1.15.x --label=automated --label=upstream --fill |
70 | | - else |
71 | | - echo "a PR already exists, editing..." |
72 | | - gh pr edit --title "[bot] Update release-v1.15.x from tektoncd-catalog/git-clone to ${NEW_COMMIT}" --body "$(cat /tmp/diff.txt | sed 's/^/ /' | head -c 55555)" |
73 | | - fi |
74 | | - env: |
75 | | - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 54 | + git config user.name openshift-pipelines-bot |
| 55 | + git config user.email pipelines-extcomm@redhat.com |
| 56 | + git checkout -b actions/update/sources-release-v1.15.x |
| 57 | + touch head |
| 58 | + pushd upstream |
| 59 | + OLD_COMMIT=$(cat ../head) |
| 60 | + NEW_COMMIT=$(git rev-parse HEAD) |
| 61 | + echo Previous commit: ${OLD_COMMIT} |
| 62 | + git show --stat ${OLD_COMMIT} |
| 63 | + echo New commit: ${NEW_COMMIT} |
| 64 | + git show --stat ${NEW_COMMIT} |
| 65 | + git diff --stat ${NEW_COMMIT}..${OLD_COMMIT} > /tmp/diff.txt |
| 66 | + git rev-parse HEAD > ../head |
| 67 | + popd |
| 68 | + rm -rf upstream/.git |
| 69 | + git add -f upstream head .konflux |
| 70 | + |
| 71 | + if [[ -z $(git status --porcelain --untracked-files=no) ]]; then |
| 72 | + echo "No change, exiting" |
| 73 | + exit 0 |
| 74 | + fi |
| 75 | + |
| 76 | + git commit -F- <<EOF |
| 77 | + [bot] Update release-v1.15.x from tektoncd-catalog/git-clone:release-v1.0.x to ${NEW_COMMIT} |
| 78 | + |
| 79 | + $ git diff --stat ${NEW_COMMIT}..${OLD_COMMIT} |
| 80 | + $(cat /tmp/diff.txt | sed 's/^/ /' | head -c 55555) |
| 81 | + |
| 82 | + https://github.com/tektoncd-catalog/git-clone/compare/${NEW_COMMIT}..${OLD_COMMIT} |
| 83 | + EOF |
| 84 | + |
| 85 | + git push -f origin actions/update/sources-release-v1.15.x |
| 86 | + |
| 87 | + if [ "$(gh pr list --base release-v1.15.x --head actions/update/sources-release-v1.15.x --json url --jq 'length')" = "0" ]; then |
| 88 | + echo "creating PR..." |
| 89 | + gh pr create -B release-v1.15.x -H actions/update/sources-release-v1.15.x --label=automated --label=upstream --fill |
| 90 | + else |
| 91 | + echo "a PR already exists, editing..." |
| 92 | + gh pr edit --title "[bot] Update release-v1.15.x from tektoncd-catalog/git-clone:release-v1.0.x to ${NEW_COMMIT}" --body "$(cat /tmp/diff.txt | sed 's/^/ /' | head -c 55555)" |
| 93 | + fi |
| 94 | + env: |
| 95 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments