-
New Item -> Freestyle Project
- Name:
python-commit-job
- Name:
-
General
- Execute concurrent builds if necessary:
Checked
- Execute concurrent builds if necessary:
-
Source Code Management
- Git
- Repository URL:
ssh://[email protected]:29418/${GERRIT_PROJECT}
- Credentials:
jenkins
- Advanced
- Refspec:
${GERRIT_REFSPEC}
- Branch:
${GERRIT_BRANCH}
- Additional Behaviors:
- Strategy for choosing what to build
- Choosing strategy:
Gerrit Trigger
- Checkout to a sub-directory
- Local directory for repo:
${GERRIT_PROJECT}
- Repository URL:
- Git
-
Build Environment
- Delete workspace before build starts:
Checked
- Delete workspace before build starts:
-
Build
-
Add build step:
Execute shell
-
Gist: https://gist.github.com/signed8bit
#!/usr/bin/env bash set -e virtualenv .test_venv source .test_venv/bin/activate cd ${WORKSPACE}/${GERRIT_PROJECT} pip install -r requirements-dev.txt flake8 . > ${WORKSPACE}/flake8.log py.test --junit-xml=${WORKSPACE}/nosetests.xml > ${WORKSPACE}/pytest.log
-
-
Post-build Actions
- Add post-build action:
Archive the artifacts
- Files to archive:
*.xml, *.log
- Add post-build action:
-
New Item -> Copy from (python-commit-job)
- Name:
python-release-job
- Name:
-
Build Environment
- Inject passwords to the build as environment variables
- Job passwords:
Add
- Name:
DEVPI_PASSWORD
- Password:
devnet
- Name:
- Job passwords:
- Inject passwords to the build as environment variables
-
Build
-
Edit build step:
Execute shell
-
Gist: https://gist.github.com/signed8bit
#!/usr/bin/env bash set -e virtualenv .publish_venv --system-site-packages source .publish_venv/bin/activate cd ${WORKSPACE}/${GERRIT_PROJECT} pip install devpi-client pip install -r requirements-dev.txt devpi use http://cicd-sandbox.local:3141 devpi login devnet --password=${DEVPI_PASSWORD} devpi use -l if [ "${GERRIT_EVENT_TYPE}" == "change-merged" ]; then # Make sure we are not on the patchset refspec git checkout ${GERRIT_BRANCH} devpi use devnet/release devpi upload else devpi use devnet/development devpi upload --no-vcs fi
-
-
Post-build Actions
- Remove "Archive the artifacts"
-
New Item -> MultiJob Project
- Name:
python-pipeline
- Name:
-
General
- Execute concurrent builds if necessary:
Checked
- Execute concurrent builds if necessary:
-
Build Triggers
- Gerrit event
- Choose a server:
cico-sandbox.local
- Trigger on:
Patchset Created
- Trigger on:
Change Merged
- Choose a server:
- Gerrit Projects
- Plain:
useful-lib
- Path:
**
- Plain
useful-cli
- Path
**
- Plain:
- Gerrit event
-
Build Environment
- Delete workspace before build starts:
Checked
- Delete workspace before build starts:
-
Build
- Add build step:
MultiJob Phase
- Phase name:
Commit Stage
- Phase jobs:
python-commit-job
- Continuation condition to next phase:
Successful
- Phase name:
- Add build step:
MultiJob Phase
- Phase name:
Release Stage
- Phase jobs:
python-release-job
- Continuation condition to next phase:
Successful
- Phase name:
- Add build step:
Open a Terminal (Applications -> Favorites -> Terminal) and go to ~/Projects/useful-lib
Projects/useful-lib/
Activate the needed virtual environment
lib_venv
Open the "Atom" text editor
atom ./
Edit the setup.py
file by changing 1.0.1 to 1.0.2 and save the file
version='1.0.2',
Commit your change to Git
git commit -am "Updated to v1.0.2"
Submit your change for review
git review