#1675 DO NOT MERGE THIS, testing CI
Closed 3 years ago by praiskup. Opened 3 years ago by praiskup.
Unknown source test-zuul  into  master

file added
+11
@@ -0,0 +1,11 @@

+ ---

+ - job:

+     name: csdiff-pylint

+     description: differential PyLint scan via csdiff

+     run: build_aux/zuul/pylint-csdiff-job.yaml

+     nodeset: fedora-rawhide-vm

+ 

+ - project:

+     check:

+       jobs:

+         - csdiff-pylint

@@ -515,3 +515,6 @@

                  # The worker could finish in the meantime, make sure we

                  # hgetall() once more.

                  self.redis.hset(worker_id, 'delete', 1)

+ 

+     def this_raises_new_warnings(self):

+         pass

file removed
-139
@@ -1,139 +0,0 @@

- #! /bin/bash

- 

- set +x

- set -e

- 

- # only PRs now

- case $REPO in

-     *forks*) ;;

-     *) exit 0 ;;

- esac

- 

- cleanup_actions=()

- cleanup()

- {

-     for action in "${cleanup_actions[@]}"; do

-         $action

-     done

- }

- trap cleanup EXIT

- 

- filter="

- import sys, json

- d = json.loads(sys.stdin.read())

- for member in d['members']:

-     sys.stdout.write(' ' + member + ' ')

- print()

- "

- 

- visible_info()

- {

-     echo

-     echo

-     echo "===> $*"

-     echo

-     echo

- }

- 

- visible_info "Checking whether we want to run against $REPO/$BRANCH"

- 

- # only copr-team for now

- members=$(curl https://pagure.io/api/0/group/copr \

-     | python3 -c "$filter")

- 

- # https://pagure.io/pagure/issue/4807

- copr_sig_member=false

- for member in $members; do

-     case $REPO in

-         *forks/$member/*)

-             copr_sig_member=true

-             break

-             ;;

-     esac

- done

- 

- if ! $copr_sig_member; then

-     visible_info "$REPO doesn't belong to anyone from Copr Team members"

-     exit 0

- fi

- 

- git remote rm proposed || true

- git remote add proposed "$REPO"

- git fetch proposed

- git checkout "proposed/$BRANCH"

- 

- : "${DIFF_AGAINST=origin/master}"

- 

- subdirs=(

-     -e ^ansible$

-     -e ^backend$

-     -e ^behave$

-     -e ^frontend$

-     -e ^distgit$

-     -e ^cli$

-     -e ^common$

-     -e ^messaging$

-     -e ^rpmbuild$

-     -e ^keygen$

-     -e ^python$

- )

- 

- changed_packages=$(

-     git diff --name-only "$DIFF_AGAINST" \

-         | cut -d'/' -f1 | sort | uniq \

-         | grep "${subdirs[@]}"

- ) || :

- 

- test -n "$changed_packages" || exit 0

- 

- 

- run_linter()

- {

-     test -f build_aux/linter || return 0

-     mkdir -p image

-     image=copr-lint-container:latest

-     cat > image/Dockerfile <<EOF

- From fedora:32

- RUN dnf install -y csdiff git pylint

- EOF

-     ( cd image

-       docker build -t "$image" .

-     )

-     container=$(docker run --rm -v "$PWD":/workdir:Z -d "$image" sleep 1800)

-     cleanup_actions+=( "docker kill $container" )

-     failed_packages=()

-     success=true

-     for package; do

-         echo "==== Testing package $package modified by this PR ===="

-         if ! docker exec "$container" bash -c "cd /workdir/$package && ../build_aux/linter --print-fixed-errors --compare-against $DIFF_AGAINST"; then

-             failed_packages+=( "$package" )

-             success=false

-         fi

-     done

- 

-     echo "=================="

-     echo "=================="

-     echo "=================="

-     echo

- 

-     if test "${#failed_packages}" -ne 0; then

-         echo "Those packages failed the PyLint diff testing:"

-         echo

-         for package in "${failed_packages[@]}"; do

-             echo " ==>  $package"

-         done

-         echo

-         echo "See the logs above."

-     else

-         echo "All these modified packages succeeded the PyLint tests: $*"

-     fi

- 

-     echo

-     echo "=================="

-     echo "=================="

-     echo "=================="

- 

-     $success

- }

- 

- run_linter $changed_packages

@@ -0,0 +1,17 @@

+ ---

+ - hosts: all

+   tasks:

+   - name: install packages needed for the check

+     package:

+       state: present

+       name:

+         - csdiff

+         - git

+         - pylint

+     become: yes

+ 

+   - name: Run the differential pylint check

+     shell: |

+       cd "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}" && \

+       ./build_aux/zuul/pylint-csdiff-script safety-check

+     # TODO: move to chdir: (currently broken)

@@ -0,0 +1,79 @@

+ #! /bin/bash

+ 

+ # Rebase this PR against upstream master branch, and compare the set

+ # of old issues with the set of new issues.  Fail if there are any new.

+ # See git-log and 'jenkins-job' file for Jenkins job variant.

+ 

+ set +x

+ set -e

+ 

+ REPO=https://pagure.io/copr/copr.git

+ : "${DIFF_AGAINST=upstream/master}"

+ 

+ rebase()

+ {

+     git remote add upstream "$REPO"

+     git fetch upstream

+     git rebase upstream/master

+ }

+ 

+ get_changed_packages()

+ {

+     subdirs=(

+         -e ^ansible$

+         -e ^backend$

+         -e ^behave$

+         -e ^frontend$

+         -e ^distgit$

+         -e ^cli$

+         -e ^common$

+         -e ^messaging$

+         -e ^rpmbuild$

+         -e ^keygen$

+         -e ^python$

+     )

+ 

+     changed_packages=$(

+         git diff --name-only "$DIFF_AGAINST" \

+             | cut -d'/' -f1 | sort | uniq \

+             | grep "${subdirs[@]}"

+     ) || :

+ 

+     test -n "$changed_packages" || {

+         echo "No package modified."

+         exit 0

+     }

+ }

+ 

+ run_linter()

+ {

+     package=$1

+     linter_cmd=(../build_aux/linter --print-fixed-errors --compare-against)

+     echo "==== Testing package $package modified by this PR ===="

+     ( cd "$package" &&  "${linter_cmd[@]}" "$DIFF_AGAINST" )

+ }

+ 

+ if test "$1" != safety-check; then

+     echo "Be careful, this modifies git directry, STOP!"

+     exit 1

+ fi

+ 

+ rebase

+ 

+ get_changed_packages

+ 

+ failed_packages=()

+ for package in $changed_packages; do

+     if ! run_linter "$package"; then

+         failed_packages+=( "$package" )

+     fi

+ done

+ 

+ echo =====

+ 

+ if test 0 -eq "${#failed_packages}"; then

+     echo "SUCCESS!  No new PyLint issues."

+ else

+     echo "FAILURE!  PyLint issues in packages: ${failed_packages[*]}"

+     exit 1

+ fi

no initial comment

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci

OK, the auto-rebase works fine, and only one new pylint issue was added.

Pull-Request has been closed by praiskup

3 years ago