Skip to content
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

Continues processing index entries upon errors, updates buildconfig names to lower case #617

Merged
merged 4 commits into from Sep 10, 2018

Conversation

Projects
None yet
3 participants
@navidshaikh
Copy link
Collaborator

navidshaikh commented Sep 6, 2018

Updated the PR to change the behavior of seed-job as well.
Now the seed-job will continue to process rest of the entries in index if it encountered errors while processing index. It will print the error and move on.

Fix OSIO 1522
Since OpenShift doesn't allow the value of metadata.name to have uppercase chars.
Added a regular expression to validate the pipeline name generated
for using in template's metadata.name field. oc imposes certain guidelines
for same and provides the regular expression in error/help message to be
used for validation in case it found some invalid string.

We are using same regular expression as provided by oc to validate
the pipeline name while processing index and generating build configs
from it.

Added a custom exception, which will be raised if the populated string
is invalid.

Added a unit test as well to test the functionality.

navidshaikh added some commits Aug 30, 2018

Converts pipeline name to lower case
 Fix OSIO 1522

 Since OpenShift doesn't allow the value of `metadata.name` to have uppercase chars.

 This commit also adds a unit test case.
Ensures the pipeline name confronts to allowed pattern
 Added a regular expression to validate the pipeline name generated
 for using in template's metadata.name field. oc imposes certain guidelines
 for same and provides the regular expression in error/help message to be
 used for validation in case it found some invalid string.

 We are using same regular expression as provided by oc to validate
 the pipeline name while processing index and generating build configs
 from it.

 Added a custom exception, which will be raised if the populated string
 is invalid.

 Added a unit test as well to test the functionality.
@dharmit
Copy link
Collaborator

dharmit left a comment

Couple of comments. Looks good otherwise.

Show resolved Hide resolved ccp/index_reader.py Outdated
Show resolved Hide resolved ccp/index_reader.py
@dharmit

dharmit approved these changes Sep 7, 2018

Copy link
Collaborator

dharmit left a comment

LGTM

Continues processing index upon failure processing entries
  Updates the seed-job behavior to continue processing the index
  if it encounters exception while processing index.
  Earlier seed-job would stop processing index if exception occurred
  in between.

@navidshaikh navidshaikh force-pushed the navidshaikh:fix-buildconfig-name branch from 0507b94 to 74b36f3 Sep 7, 2018

@navidshaikh

This comment has been minimized.

Copy link
Collaborator Author

navidshaikh commented Sep 7, 2018

Updated the PR to change the behavior of seed-job as well.
Now the seed-job will continue to process rest of the entries in index if it encountered errors while processing index. It will print the error and move on.

@navidshaikh navidshaikh changed the title Converts pipeline name to lower case Continues processing index entries upon errors, updates buildconfig names to lower case Sep 7, 2018

@navidshaikh

This comment has been minimized.

Copy link
Collaborator Author

navidshaikh commented Sep 7, 2018

Added 3 new unit tests to test the functionality. Sample run

nosetests -w . -v tests 
IndexReader: Tests processing pipeline_name ... ok
IndexReader: Tests processing pipeline_name for upper case params ... ok
IndexReader: Tests exception while processing pipeline name ... ok
Tests creating Project class object which loads entries ... ok
IndexReader: Tests exception while loading invalid index entry ... ok
Test processing pre_build_context ... ok
Test processing pre_build_script ... ok
Tests depends_on field processing and defaults ... ok
Tests desired tag processing and defaults ... ok
Test the helper method to replace . / : _ with hyphen ... ok
Test __str__ representation of Project object ... ok
Notifications: Tests processing body of email ... ok
Notitications: Tests processing subject of email ... ok

----------------------------------------------------------------------
Ran 13 tests in 0.002s

OK
@navidshaikh

This comment has been minimized.

Copy link
Collaborator Author

navidshaikh commented Sep 7, 2018

Tested the functionality by explicitly malforming an index entry (removed target-file here). Sample output of seed-job run

+ python ccp/index_reader.py /tmp/container-index/index.d 172.29.33.53:5000 cccp nshaikh@redhat.com smtp://mail.centos.org
Error processing index entry {u'app-id': u'centos', u'git-url': u'https://github.com/sclorg/s2i-perl-container.git', u'git-path': u'5.20/', u'build-context': u'./', u'depends-on': [u'centos/centos:latest', u'centos/s2i-core-centos7:latest', u'centos/s2i-base-centos7:latest'], u'notify-email': u'shaikhnavid14@gmail.com', u'desired-tag': u'latest', u'git-branch': u'master', u'job-id': u'perl-520-centos7', u'id': u'1'}. Moving on.
Error: 'target-file'
Number of projects in index 9
Number of projects in OpenShift 0
Number of projects to be updated/created: 9

@dharmit dharmit added the prod label Sep 10, 2018

@dharmit dharmit merged commit 1bb498b into CentOS:openshift Sep 10, 2018

1 check passed

centos-ci tests centos-ci test succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.