diff options
43 files changed, 1555 insertions, 309 deletions
diff --git a/.gitignore b/.gitignore index eeabaeb63..2c1894879 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ testapi_venv/ .tox *.retry job_output/ +utils/test/testapi/opnfv_testapi/tests/UI/coverage diff --git a/docs/ci/index.rst b/docs/ci/index.rst new file mode 100644 index 000000000..da6fc7de1 --- /dev/null +++ b/docs/ci/index.rst @@ -0,0 +1,18 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. (c) Open Platform for NFV Project, Inc. and its contributors + +.. _ci-overview: + +======== +OPNFV CI +======== + +TBD + +.. toctree:: + :numbered: + :maxdepth: 2 + + user-guide + resources diff --git a/docs/ci/resources.rst b/docs/ci/resources.rst new file mode 100644 index 000000000..572852c48 --- /dev/null +++ b/docs/ci/resources.rst @@ -0,0 +1,61 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. (c) Open Platform for NFV Project, Inc. and its contributors + +.. _ci-resources: + +============ +CI Resources +============ + +CI for OPNFV requires a range of resources in order to meet testing and +verification needs. Each resource must meet a set of criteria in order +to be part of CI for an OPNFV release. There are three types of +resources: + + - Baremetal PODs (PODs) + - Virtual PODs (vPODs) + - Build Servers + +-------------- +Baremetal PODs +-------------- + +TBD + +~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Baremetal PODs Requirements +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In order of a POD to be considered CI-Ready the following requirements +must be met: + + #. Pharos Compliant and has a PDF + #. Connected to Jenkins + #. 24/7 Uptime + #. No Development + #. No manual intervention + +------------ +Virtual PODS +------------ + +TBD + +~~~~~~~~~~~~ +Requirements +~~~~~~~~~~~~ + +TBD + +------------- +Build Servers +------------- + +TBD + +~~~~~~~~~~~~ +Requirements +~~~~~~~~~~~~ + +TBD diff --git a/docs/ci/user-guide.rst b/docs/ci/user-guide.rst new file mode 100644 index 000000000..9c9b74a41 --- /dev/null +++ b/docs/ci/user-guide.rst @@ -0,0 +1,11 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. (c) Open Platform for NFV Project, Inc. and its contributors + +.. _ci-user-guide: + +============= +CI User Guide +============= + +TBD diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 000000000..62a828adf --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,17 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. (c) Open Platform for NFV Project, Inc. and its contributors + +.. _releng: + +=================== +Release Engineering +=================== + +.. toctree:: + :numbered: + :maxdepth: 2 + + release/index + ci/index + infra/index diff --git a/docs/infra/artifacts/docker-hub.rst b/docs/infra/artifacts/docker-hub.rst new file mode 100644 index 000000000..1da6c474a --- /dev/null +++ b/docs/infra/artifacts/docker-hub.rst @@ -0,0 +1,12 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. (c) Open Platform for NFV Project, Inc. and its contributors + +.. _docker-hub: + +========== +Docker Hub +========== + +TBD + diff --git a/docs/infra/artifacts/index.rst b/docs/infra/artifacts/index.rst new file mode 100644 index 000000000..28b3b45fb --- /dev/null +++ b/docs/infra/artifacts/index.rst @@ -0,0 +1,11 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. (c) Open Platform for NFV Project, Inc. and its contributors + +.. _artifact-repository: + +=================== +Artifact Repository +=================== + +TBD diff --git a/docs/infra/gerrit/user-guide.rst b/docs/infra/gerrit/user-guide.rst new file mode 100644 index 000000000..3b1c3f807 --- /dev/null +++ b/docs/infra/gerrit/user-guide.rst @@ -0,0 +1,9 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. (c) Open Platform for NFV Project, Inc. and its contributors + +.. _gerrit: + +================= +Gerrit User Guide +================= diff --git a/docs/infra/index.rst b/docs/infra/index.rst new file mode 100644 index 000000000..50c971e75 --- /dev/null +++ b/docs/infra/index.rst @@ -0,0 +1,93 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. (c) Open Platform for NFV Project, Inc. and its contributors + +.. _software-infrastructure: + +======================= +Software Infrastructure +======================= + +OPNFV Software Infrastructure consists of set of components and tools that +realize OPNFV Continuous Integration (CI) and provide means for community to +contribute to OPNFV in most efficient way. OPNFV Software Infrastructure +enables and orchestrates development, integration and testing activities for +the components OPNFV consumes from upstream communities and for the development +work done in scope of OPNFV. Apart from orchestration aspects, providing timely +feedback that is fit for purpose to the OPNFV community is one of its missions. + +CI is the top priority for OPNFV Software Infrastructure. Due to the importance +the OPNFV community puts into it, the resulting CI machinery is highly +powerful, capable and runs against distributed hardware infrastructure managed +by OPNFV Pharos_ Project. The hardware infrastructure OPNFV CI relies on is +located in 3 different continents, 5+ different countries and 10+ different +member companies. + +OPNFV CI is continuously evolved in order to fulfill the needs and match the +expectations of the OPNFV community. + +OPNFV Software Infrastructure is developed, maintained and operated by OPNFV +Releng_ Project with the support from Linux Foundation. + +Continuous Integration Server +----------------------------- + +Jenkins + +.. toctree:: + :maxdepth: 1 + + jenkins/connect-to-jenkins + jenkins/user-guide + jenkins/jjb-usage + jenkins/labels + +Source Control and Code Review +------------------------------ + +Gerrit + +.. toctree:: + :maxdepth: 1 + + gerrit/user-guide + +Artifact and Image Repositories +------------------------------- + +Google Storage & Docker Hub + +.. toctree:: + :maxdepth: 1 + + artifacts/index + artifacts/docker-hub + + +Issue and Bug Tracking +---------------------- + +JIRA + +.. toctree:: + :maxdepth: + + jira/user-guide + + +Dashboards and Analytics +------------------------ + + - `Pharos Dashboard`_ + + - `Test Results`_ + + - `Bitergia Dashboard`_ + + +.. _Pharos: https://wiki.opnfv.org/display/pharos/Pharos+Home +.. _Releng: https://wiki.opnfv.org/display/releng/Releng + +.. _Bitergia Dashboard: https://opnfv.biterg.io/ +.. _Pharos Dashboard: https://labs.opnfv.org/ +.. _Test Results: https://testresults.opnfv.org/ diff --git a/docs/infra/jenkins/connect-to-jenkins.rst b/docs/infra/jenkins/connect-to-jenkins.rst new file mode 100644 index 000000000..e83cadada --- /dev/null +++ b/docs/infra/jenkins/connect-to-jenkins.rst @@ -0,0 +1,187 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. (c) Open Platform for NFV Project, Inc. and its contributors + +.. _connect-to-jenkins: + +================================================ +Connecting OPNFV Community Labs to OPNFV Jenkins +================================================ + +.. contents:: Table of Contents + :backlinks: none + +Abstract +======== + +This document describes how to connect resources (servers) located in Linux Foundation (LF) lab +and labs provided by the OPNFV Community to OPNFV Jenkins. + +License +======= +Connecting OPNFV Community Labs to OPNFV Jenkins (c) by Fatih Degirmenci (Ericsson AB) and others. + +Connecting OPNFV Labs to OPNFV Jenkins document is licensed under a Creative Commons +Attribution 4.0 International License. + +You should have received a copy of the license along with this. If not, see <http://creativecommons.org/licenses/by/4.0/>. + + +Version History +=============== + ++------------+-------------+------------------+---------------------------------------+ +| **Date** | **Version** | **Author** | **Comment** | +| | | | | ++------------+-------------+------------------+---------------------------------------+ +| 2015-05-05 | 0.1.0 | Fatih Degirmenci | First draft | +| | | | | ++------------+-------------+------------------+---------------------------------------+ +| 2015-09-25 | 1.0.0 | Fatih Degirmenci | Instructions for the | +| | | | Arno SR1 release | ++------------+-------------+------------------+---------------------------------------+ +| 2016-01-25 | 1.1.0 | Jun Li | Change the format for | +| | | | new doc toolchain | ++------------+-------------+------------------+---------------------------------------+ +| 2016-01-27 | 1.2.0 | Fatih Degirmenci | Instructions for the | +| | | | Brahmaputra release | ++------------+-------------+------------------+---------------------------------------+ +| 2016-05-25 | 1.3.0 | Julien | Add an additional step after step9 to | +| | | | output the correct monit config file | ++------------+-------------+------------------+---------------------------------------+ + +Jenkins +======= + +Jenkins is an extensible open source Continuous Integration (CI) server. [1] + +Linux Foundation (LF) hosts and operates `OPNFV Jenkins <https://build.opnfv.org/ci/>`_. + +Jenkins Slaves +============== + +**Slaves** are computers that are set up to build projects for a **Jenkins Master**. [2] + +Jenkins runs a separate program called "**slave agent**" on slaves. +When slaves are registered to a master, the master starts distributing load to slaves by +scheduling jobs to run on slaves if the jobs are set to run on them. [2] + +Term **Node** is used to refer to all machines that are part of Jenkins grid, slaves and +master. [2] + +Two types of slaves are currently connected to OPNFV Jenkins and handling +different tasks depending on the purpose of connecting the slave. + +* Slaves hosted in `LF Lab <https://wiki.opnfv.org/get_started/lflab_hosting#hardware_setup>`_ +* Slaves hosted in `Community Test Labs <https://wiki.opnfv.org/pharos#community_test_labs>`_ + +The slaves connected to OPNFV Jenkins can be seen using this link: +https://build.opnfv.org/ci/computer/ + +Slaves without red cross next to computer icon are fully functional. + +Connecting Slaves to OPNFV Jenkins +================================== + +The method that is normally used for connecting slaves to Jenkins requires direct SSH access to +servers. +[3] This is the method that is used for connecting slaves hosted in LF Lab. + +Connecting slaves using direct SSH access can become a challenge given that OPNFV Project +has number of different labs provided by community as mentioned in previous section. +All these labs have different security requirements which can increase the effort +and the time needed for connecting slaves to Jenkins. +In order to reduce the effort and the time needed for connecting slaves and streamline the +process, it has been decided to connect slaves using +`Java Network Launch Protocol (JNLP) <https://docs.oracle.com/javase/tutorial/deployment/deploymentInDepth/jnlp.html>`_. + +Connecting Slaves from LF Lab to OPNFV Jenkins +---------------------------------------------- + +Slaves hosted in LF Lab are handled by LF. All the requests and questions regarding +these slaves should be submitted to `OPNFV LF Helpdesk <opnfv-helpdesk@rt.linuxfoundation.org>`_. + +Connecting Slaves from Community Labs to OPNFV Jenkins +------------------------------------------------------ + +As noted in corresponding section, slaves from Community Labs are connected using JNLP. Via JNLP, +slaves open connection towards Jenkins Master instead of Jenkins Master accessing to them directly. + +Servers connecting to OPNFV Jenkins using this method must have access to internet. + +Please follow below steps to connect a slave to OPNFV Jenkins. + + 1. Create a user named **jenkins** on the machine you want to connect to OPNFV Jenkins and give the user sudo rights. + 2. Install needed software on the machine you want to connect to OPNFV Jenkins as slave. + - openjdk 8 + - monit + 3. If the slave will be used for running virtual deployments, Functest, and Yardstick, install below software and make jenkins user the member of the groups. + - docker + - libvirt + 4. Create slave root in Jenkins user home directory. + ``mkdir -p /home/jenkins/opnfv/slave_root`` + 5. Clone OPNFV Releng Git repository. + ``mkdir -p /home/jenkins/opnfv/repos`` + + ``cd /home/jenkins/opnfv/repos`` + + ``git clone https://gerrit.opnfv.org/gerrit/p/releng.git`` + 6. Contact LF by sending mail to `OPNFV LF Helpdesk <opnfv-helpdesk@rt.linuxfoundation.org>`_ and request creation of a slave on OPNFV Jenkins. Include below information in your mail. + - Slave root (/home/jenkins/opnfv/slave_root) + - Public IP of the slave (You can get the IP by executing ``curl http://icanhazip.com/``) + - PGP Key (attached to the mail or exported to a key server) + 7. Once you get confirmation from LF stating that your slave is created on OPNFV Jenkins, check if the firewall on LF is open for the server you are trying to connect to Jenkins. + ``cp /home/jenkins/opnfv/repos/releng/utils/jenkins-jnlp-connect.sh /home/jenkins/`` + ``cd /home/jenkins/`` + ``sudo ./jenkins-jnlp-connect.sh -j /home/jenkins -u jenkins -n <slave name on OPNFV Jenkins> -s <the token you received from LF> -f`` + + - If you receive an error, follow the steps listed on the command output. + 8. Run the same script with test(-t) on foreground in order to make sure no problem on connection. You should see **INFO: Connected** in the console log. + ``sudo ./jenkins-jnlp-connect.sh -j /home/jenkins -u jenkins -n <slave name on OPNFV Jenkins> -s <the token you received from LF> -t`` + + - If you receive an error similar to the one shown `on this link <http://hastebin.com/ozadagirax.avrasm>`_, you need to check your firewall and allow outgoing connections for the port. + 9. Kill the Java slave.jar process. + 10. Run the same script normally without test(-t) in order to get monit script created. + ``sudo ./jenkins-jnlp-connect.sh -j /home/jenkins -u jenkins -n <slave name on OPNFV Jenkins> -s <the token you received from LF>`` + 11. Edit monit configuration and enable http interface. The file to edit is /etc/monit/monitrc on Ubuntu systems. Uncomment below lines. + set httpd port 2812 and + use address localhost # only accept connection from localhost + allow localhost # allow localhost to connect to the server and + 12. Restart monit service. + - Without systemd: + + ``sudo service monit restart`` + - With systemd: you have to enable monit service first and then restart it. + + ``sudo systemctl enable monit`` + + ``sudo systemctl restart monit`` + 13. Check to see if jenkins comes up as managed service in monit. + ``sudo monit status`` + 14. Connect slave to OPNFV Jenkins using monit. + ``sudo monit start jenkins`` + 15. Check slave on OPNFV Jenkins to verify the slave is reported as connected. + - The slave on OPNFV Jenkins should have some executors in “Idle” state if the connection is successful. + +Notes +========== + +PGP Key Instructions +-------------------- + +Public PGP Key can be uploaded to public key server so it can be taken from +there using your mail address. Example command to upload the key to key server is + + ``gpg --keyserver hkp://keys.gnupg.net:80 --send-keys XXXXXXX`` + +The Public PGP Key can also be attached to the email by storing the key in a file and then +attaching it to the email. + + ``gpg --export -a '<your email address>' > pgp.pubkey`` + +References +========== + +* `What is Jenkins <https://wiki.jenkins-ci.org/display/JENKINS/Meet+Jenkins>`_ +* `Jenkins Terminology <https://wiki.jenkins-ci.org/display/JENKINS/Terminology>`_ +* `Jenkins SSH Slaves Plugin <https://wiki.jenkins-ci.org/display/JENKINS/SSH+Slaves+plugin>`_ diff --git a/docs/jenkins-job-builder/opnfv-jjb-usage.rst b/docs/infra/jenkins/jjb-usage.rst index f34833f5c..2be2598d9 100644 --- a/docs/jenkins-job-builder/opnfv-jjb-usage.rst +++ b/docs/infra/jenkins/jjb-usage.rst @@ -1,3 +1,9 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. (c) Open Platform for NFV Project, Inc. and its contributors + +.. _jjb: + =========================================== Creating/Configuring/Verifying Jenkins Jobs =========================================== @@ -16,9 +22,9 @@ Make changes:: remote: Processing changes: new: 1, refs: 1, done remote: remote: New Changes: - remote: https://gerrit.opnfv.org/gerrit/51 + remote: https://gerrit.opnfv.org/gerrit/<CHANGE_ID> remote: - To ssh://agardner@gerrit.opnfv.org:29418/releng.git + To ssh://YOU@gerrit.opnfv.org:29418/releng.git * [new branch] HEAD -> refs/publish/master Test with tox:: @@ -29,12 +35,12 @@ Submit the change to gerrit:: git review -v -Follow the link to gerrit https://gerrit.opnfv.org/gerrit/51 in a few moments -the verify job will have completed and you will see Verified +1 jenkins-ci in -the gerrit ui. +Follow the link given in the stdoutput to gerrit eg: +``https://gerrit.opnfv.org/gerrit/<CHANGE_ID>`` the verify job will +have completed and you will see Verified +1 jenkins-ci in the gerrit ui. If the changes pass the verify job -https://build.opnfv.org/ci/view/builder/job/builder-verify-jjb/ , +https://build.opnfv.org/ci/job/releng-verify-jjb/ , the patch can be submitited by a committer. Job Types @@ -65,24 +71,13 @@ it will reset the verified status to 0. If you want to keep the verified status, use **recheck-experimental** in commit message to trigger both verify and experimental jobs. -You can add below persons as reviewers to your patch in order to get it -reviewed and submitted. - -* fatih.degirmenci@ericsson.com -* agardner@linuxfoundation.org -* trozet@redhat.com -* morgan.richomme@orange.com -* vlaza@cloudbasesolutions.com -* matthew.lijun@huawei.com -* meimei@huawei.com -* jose.lausuch@ericsson.com -* koffirodrigue@gmail.com -* r-mibu@cq.jp.nec.com -* tbramwell@linuxfoundation.org +You can look in the releng/INFO file for a list of current committers to +add as reviewers to your patch in order to get it reviewed and +submitted. Or Add the group releng-contributors -Or just email a request for submission to opnfv-helpdesk@rt.linuxfoundation.org +Or just email a request for review to helpdesk@opnfv.org The Current merge and verify jobs for jenkins job builder can be found in `releng-jobs.yaml`_. diff --git a/docs/infra/jenkins/labels.rst b/docs/infra/jenkins/labels.rst new file mode 100644 index 000000000..6327518af --- /dev/null +++ b/docs/infra/jenkins/labels.rst @@ -0,0 +1,11 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. (c) Open Platform for NFV Project, Inc. and its contributors + +.. _jenkins-labels: + +=================== +Jenkins Node Labels +=================== + +TBD diff --git a/docs/infra/jenkins/user-guide.rst b/docs/infra/jenkins/user-guide.rst new file mode 100644 index 000000000..60236416a --- /dev/null +++ b/docs/infra/jenkins/user-guide.rst @@ -0,0 +1,11 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. (c) Open Platform for NFV Project, Inc. and its contributors + +.. _jenkins-user-guide: + +================== +Jenkins User Guide +================== + +TBD diff --git a/docs/infra/jira/user-guide.rst b/docs/infra/jira/user-guide.rst new file mode 100644 index 000000000..5009bc1b0 --- /dev/null +++ b/docs/infra/jira/user-guide.rst @@ -0,0 +1,11 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. (c) Open Platform for NFV Project, Inc. and its contributors + +.. _jira-user-guide: + +=============== +JIRA User Guide +=============== + +TBD diff --git a/docs/jenkins-job-builder/index.rst b/docs/jenkins-job-builder/index.rst deleted file mode 100644 index 4d23ade38..000000000 --- a/docs/jenkins-job-builder/index.rst +++ /dev/null @@ -1,9 +0,0 @@ -=========================== -Release Engineering Project -=========================== - -.. toctree:: - :numbered: - :maxdepth: 2 - - opnfv-jjb-usage diff --git a/docs/release/index.rst b/docs/release/index.rst new file mode 100644 index 000000000..d7d8acd39 --- /dev/null +++ b/docs/release/index.rst @@ -0,0 +1,17 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. (c) Open Platform for NFV Project, Inc. and its contributors + +.. _release: + +=============== +Releasing OPNFV +=============== + +.. toctree:: + :numbered: + :maxdepth: 2 + + release-process + stable-branch-guide + versioning diff --git a/docs/release/release-process.rst b/docs/release/release-process.rst new file mode 100644 index 000000000..b88832f95 --- /dev/null +++ b/docs/release/release-process.rst @@ -0,0 +1,11 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. (c) Open Platform for NFV Project, Inc. and its contributors + +.. _release-process: + +=============== +Release Process +=============== + +TBD diff --git a/docs/release/stable-branch-guide.rst b/docs/release/stable-branch-guide.rst new file mode 100644 index 000000000..a4710f656 --- /dev/null +++ b/docs/release/stable-branch-guide.rst @@ -0,0 +1,11 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. (c) Open Platform for NFV Project, Inc. and its contributors + +.. _stable-branch: + +============= +Stable Branch +============= + +TBD diff --git a/docs/release/versioning.rst b/docs/release/versioning.rst new file mode 100644 index 000000000..3257d3bea --- /dev/null +++ b/docs/release/versioning.rst @@ -0,0 +1,11 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. (c) Open Platform for NFV Project, Inc. and its contributors + +.. _versioning: + +========== +Versioning +========== + +TBD diff --git a/jjb/container4nfv/container4nfv-project.yml b/jjb/container4nfv/container4nfv-project.yml index ffdbf9551..9e2d313c8 100644 --- a/jjb/container4nfv/container4nfv-project.yml +++ b/jjb/container4nfv/container4nfv-project.yml @@ -31,6 +31,12 @@ - project-parameter: project: '{project}' branch: '{branch}' + # yamllint disable rule:line-length + - string: + name: GIT_BASE + default: https://gerrit.opnfv.org/gerrit/$PROJECT + description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW." + # yamllint enable rule:line-length - 'opnfv-build-ubuntu-defaults' scm: @@ -82,6 +88,12 @@ - project-parameter: project: '{project}' branch: '{branch}' + # yamllint disable rule:line-length + - string: + name: GIT_BASE + default: https://gerrit.opnfv.org/gerrit/$PROJECT + description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW." + # yamllint enable rule:line-length - node: name: SLAVE_NAME description: 'Slave name on Jenkins' @@ -97,6 +109,6 @@ - timed: '@midnight' builders: - - shell: + - shell: | cd $WORKSPACE/ci ./deploy.sh diff --git a/jjb/daisy4nfv/daisy-daily-jobs.yml b/jjb/daisy4nfv/daisy-daily-jobs.yml index f2626db1c..090d2e1f2 100644 --- a/jjb/daisy4nfv/daisy-daily-jobs.yml +++ b/jjb/daisy4nfv/daisy-daily-jobs.yml @@ -93,7 +93,9 @@ - build-blocker: use-build-blocker: true blocking-jobs: + - 'daisy-os-.*?-{pod}-daily-.*?' - 'daisy-daily-.*' + - 'daisy-kolla-build-.*' block-level: 'NODE' wrappers: @@ -177,6 +179,7 @@ use-build-blocker: true blocking-jobs: - 'daisy.*-deploy-({pod})?-daily-.*' + - 'daisy-kolla-build-.*' block-level: 'NODE' parameters: diff --git a/jjb/daisy4nfv/daisy-project-jobs.yml b/jjb/daisy4nfv/daisy-project-jobs.yml index b6e9526e3..006153f6f 100644 --- a/jjb/daisy4nfv/daisy-project-jobs.yml +++ b/jjb/daisy4nfv/daisy-project-jobs.yml @@ -37,6 +37,72 @@ jobs: - '{installer}-daily-{stream}' - '{installer}-{phase}-daily-{stream}' + - '{installer}-kolla-build-{stream}' + +############################# +# docker build job templates +############################# +- job-template: + name: '{installer}-kolla-build-{stream}' + disabled: false + concurrent: true + + properties: + - logrotate-default + - throttle: + enabled: true + max-total: 4 + option: 'project' + - build-blocker: + use-build-blocker: true + # Note: Need to block all jobs which may create daisy VM. + blocking-jobs: + - '{installer}-kolla-build-.*' + - 'daisy-deploy-.*' + - 'daisy-daily-.*' + block-level: 'NODE' + + scm: + - git-scm + + triggers: + - 'daisy-kolla-build-{stream}-trigger' + + parameters: + - project-parameter: + project: '{project}' + branch: '{branch}' + - 'daisy-virtual-defaults' + - '{installer}-defaults' + - '{installer}-project-parameter': + gs-pathname: '{gs-pathname}' + + wrappers: + - ssh-agent-wrapper + - timeout: + timeout: 720 + fail: true + + builders: + - description-setter: + description: "Built on $NODE_NAME" + - shell: + !include-raw-escape: ./daisy4nfv-build-kolla-image.sh + + publishers: + - '{installer}-recipients' + - email-jenkins-admins-on-failure + +- trigger: + name: 'daisy-kolla-build-euphrates-trigger' + triggers: + - timed: '0 0 * * 0' + +- trigger: + name: 'daisy-kolla-build-master-trigger' + triggers: + - timed: '0 12 * * 0' + ######################## # job templates @@ -60,6 +126,7 @@ use-build-blocker: true blocking-jobs: - '{installer}-daily-.*' + - '{installer}-kolla-build-.*' - 'daisy4nfv-merge-build-.*' - 'daisy4nfv-verify-build-.*' block-level: 'NODE' diff --git a/jjb/daisy4nfv/daisy4nfv-build-kolla-image.sh b/jjb/daisy4nfv/daisy4nfv-build-kolla-image.sh new file mode 100755 index 000000000..9a1e2fc20 --- /dev/null +++ b/jjb/daisy4nfv/daisy4nfv-build-kolla-image.sh @@ -0,0 +1,94 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2016 ZTE Coreporation and others. +# hu.zhijiang@zte.com.cn +# sun.jing22@zte.com.cn +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + + +set -o errexit +set -o nounset +set -o pipefail + +importkey () { + # clone releng repository + echo "Cloning releng repository..." + [ -d releng ] && rm -rf releng + git clone https://gerrit.opnfv.org/gerrit/releng ./releng/ &> /dev/null + #this is where we import the siging key + if [ -f ./releng/utils/gpg_import_key.sh ]; then + source ./releng/utils/gpg_import_key.sh + fi +} + +upload_image_to_opnfv () { + image=$1 + + importkey + if gpg2 --list-keys | grep "opnfv-helpdesk@rt.linuxfoundation.org"; then + echo "Signing Key avaliable" + SIGN_ARTIFACT="true" + fi + + if [[ -n "$SIGN_ARTIFACT" && "$SIGN_ARTIFACT" == "true" ]]; then + gpg2 -vvv --batch --yes --no-tty \ + --default-key opnfv-helpdesk@rt.linuxfoundation.org \ + --passphrase besteffort \ + --detach-sig $image + gsutil cp $image.sig gs://$GS_URL/upstream/$image.sig + echo "Image signature upload complete!" + fi + + sha512sum -b $image > $image.sha512sum + gsutil cp $image.sha512sum gs://$GS_URL/upstream/$image.sha512sum + + echo "Uploading $INSTALLER_TYPE artifact. This could take some time..." + echo + gsutil cp $image gs://$GS_URL/upstream/$image + gsutil -m setmeta \ + -h "Cache-Control:private, max-age=0, no-transform" \ + gs://$GS_URL/upstream/$image + + # check if we uploaded the file successfully to see if things are fine + gsutil ls gs://$GS_URL/upstream/$image + if [[ $? -ne 0 ]]; then + echo "Problem while uploading artifact!" + exit 1 + fi +} + + + +echo "--------------------------------------------------------" +echo "This is diasy4nfv kolla image build job!" +echo "--------------------------------------------------------" + +# start the build +cd $WORKSPACE +rm -rf docker_build_dir +mkdir -p docker_build_dir + +# -j is for deciding which branch will be used when building, +# only for OPNFV +sudo -E ./ci/kolla-build.sh -j $JOB_NAME -w $WORKSPACE/docker_build_dir + +if [ $? -ne 0 ]; then + echo + echo "Kolla build failed!" + deploy_ret=1 +else + echo + echo "--------------------------------------------------------" + echo "Kolla build done!" +fi + +image=$(ls $WORKSPACE/docker_build_dir/kolla-build-output/kolla-image-*.tgz) +upload_image_to_opnfv $image + +echo +echo "--------------------------------------------------------" +echo "All done!" diff --git a/jjb/doctor/doctor.yml b/jjb/doctor/doctor.yml index 6a04c5fbc..e28f74431 100644 --- a/jjb/doctor/doctor.yml +++ b/jjb/doctor/doctor.yml @@ -25,6 +25,12 @@ # slave-label: 'ool-virtual3' # pod: 'ool-virtual3' + phase: + - 'build-x86_64': + slave-label: 'opnfv-build-ubuntu' + - 'build-aarch64': + slave-label: 'opnfv-build-ubuntu-arm' + inspector: - 'sample' - 'congress' @@ -37,22 +43,23 @@ auto-trigger-name: 'doctor-verify' is-python: true - pod: - - armband-baremetal: - slave-label: '{pod}' - - armband-virtual: - slave-label: '{pod}' + exclude: + - installer: 'apex' + phase: 'build-aarch64' jobs: - 'doctor-verify-{stream}' - - 'doctor-{task}-{installer}-{inspector}-{pod}-{stream}' + - 'doctor-verify-unit-test-{stream}' - 'doctor-{task}-{installer}-{inspector}-{stream}' + - 'doctor-{task}-{installer}-{inspector}-{phase}-{stream}' - job-template: name: 'doctor-verify-{stream}' disabled: '{obj:disabled}' + project-type: 'multijob' + parameters: - project-parameter: project: '{project}' @@ -86,38 +93,54 @@ pattern: 'doctor_tests/**' builders: - - shell: "[ -e tests/run.sh ] && bash -n ./tests/run.sh" + - shell: | + #!/bin/bash + # we do nothing here as the main stuff will be done + # in phase jobs + echo "Triggering phase jobs!" + - multijob: + name: 'doctor-build-and-unittest' + execution-type: PARALLEL + projects: + - name: 'doctor-verify-unit-test-{stream}' + current-parameters: false + predefined-parameters: | + GERRIT_BRANCH=$GERRIT_BRANCH + GERRIT_REFSPEC=$GERRIT_REFSPEC + GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER + GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE + git-revision: true + node-parameters: false + kill-phase-on: FAILURE + abort-all-job: false - job-template: - name: 'doctor-{task}-{installer}-{inspector}-{pod}-{stream}' - - node: '{slave-label}' - + name: 'doctor-verify-unit-test-{stream}' disabled: '{obj:disabled}' - + wrappers: + - ssh-agent-wrapper + - build-timeout: + timeout: 60 parameters: - project-parameter: project: '{project}' branch: '{branch}' - 'opnfv-build-ubuntu-defaults' - scm: - git-scm-gerrit - - - triggers: - - '{auto-trigger-name}': - project: '{project}' - branch: '{branch}' - files: 'doctor_tests/**' - builders: - - shell: "[ -e tests/run.sh ] && bash -n ./tests/run.sh" + - 'doctor-verify-unit-test-builders-macro' + publishers: + - 'doctor-verify-unit-test-publishers-macro' - job-template: name: 'doctor-{task}-{installer}-{inspector}-{stream}' + disabled: '{obj:disabled}' + + project-type: 'multijob' + node: '{slave-label}' parameters: @@ -151,13 +174,17 @@ default: 'doctor-notification' - string: name: TESTCASE_OPTIONS + # yamllint disable rule:line-length default: '-e INSPECTOR_TYPE={inspector} -e PYTHON_ENABLE={is-python} -v $WORKSPACE:/home/opnfv/repos/doctor' + # yamllint enable rule:line-length description: 'Addtional parameters specific to test case(s)' # functest-parameter - string: name: GS_PATHNAME default: '{gs-pathname}' + # yamllint disable rule:line-length description: "Version directory where the opnfv documents will be stored in gs repository" + # yamllint enable rule:line-length - string: name: FUNCTEST_REPO_DIR default: "/home/opnfv/repos/functest" @@ -181,7 +208,59 @@ files: 'doctor_tests/**' builders: + - shell: | + #!/bin/bash + # we do nothing here as the main stuff will be done + # in phase jobs + echo "Triggering phase jobs!" + - multijob: + name: 'doctor-verify-installer-inspector' + execution-type: PARALLEL + projects: + - name: 'doctor-{task}-{installer}-{inspector}-build-x86_64-{stream}' + current-parameters: false + git-revision: true + node-parameters: false + kill-phase-on: FAILURE + abort-all-job: false + - name: 'doctor-{task}-{installer}-{inspector}-build-aarch64-{stream}' + current-parameters: false + git-revision: true + node-parameters: false + kill-phase-on: FAILURE + abort-all-job: false + +- job-template: + name: 'doctor-{task}-{installer}-{inspector}-{phase}-{stream}' + disabled: '{obj:disabled}' + wrappers: + - ssh-agent-wrapper + - build-timeout: + timeout: 30 + parameters: + - project-parameter: + project: '{project}' + branch: '{branch}' + - '{slave-label}-defaults' + scm: + - git-scm-gerrit + builders: + - 'doctor-verify-installer-inspector-builders-macro' + publishers: + - 'doctor-verify-publishers-macro' +# ------------------------------- +# builder macros +# ------------------------------- + +- builder: + name: 'doctor-verify-unit-test-builders-macro' + builders: + - shell: "[ -e tests/run.sh ] && bash -n ./tests/run.sh" +- builder: + name: 'doctor-verify-installer-inspector-builders-macro' + builders: - 'clean-workspace-log' + # yamllint disable rule:line-length - shell: | # NOTE: Create symbolic link, so that we can archive file outside # of $WORKSPACE . @@ -200,14 +279,23 @@ # NOTE: checking the test result, as the previous job could return # 0 regardless the result of doctor test scenario. grep -e 'doctor test successfully' $functest_log || exit 1 + # yamllint enable rule:line-length +# ------------------------------- +# publisher macros +# ------------------------------- +- publisher: + name: 'doctor-verify-publishers-macro' publishers: - archive: artifacts: 'doctor_tests/*.log' - archive: artifacts: 'functest_results/$FUNCTEST_SUITE_NAME.log' - email-jenkins-admins-on-failure - +- publisher: + name: 'doctor-verify-unit-test-publishers-macro' + publishers: + - email-jenkins-admins-on-failure ##################################### # trigger macros diff --git a/jjb/global/releng-macros.yml b/jjb/global/releng-macros.yml index e00047ba0..62c22bd3f 100644 --- a/jjb/global/releng-macros.yml +++ b/jjb/global/releng-macros.yml @@ -196,17 +196,6 @@ sudo chown -R $USER:$USER $WORKSPACE || exit 1 - builder: - name: build-html-and-pdf-docs-output - builders: - - shell: | - #!/bin/bash - set -o errexit - set -o xtrace - export PATH=$PATH:/usr/local/bin/ - git clone ssh://gerrit.opnfv.org:29418/opnfvdocs docs_build/_opnfvdocs - GERRIT_COMMENT=gerrit_comment.txt ./docs_build/_opnfvdocs/scripts/docs-build.sh - -- builder: name: upload-under-review-docs-to-opnfv-artifacts builders: - shell: | @@ -217,7 +206,7 @@ export PATH=$PATH:/usr/local/bin/ [[ $GERRIT_CHANGE_NUMBER =~ .+ ]] - [[ -d docs_output ]] || exit 0 + [[ -d docs/_build/ ]] || exit 0 echo echo "###########################" @@ -230,7 +219,7 @@ local_path="upload/$GERRIT_CHANGE_NUMBER" mkdir -p upload - mv docs_output "$local_path" + mv docs/_build/html/ "$local_path" gsutil -m cp -r "$local_path" "gs://$gs_base" gsutil -m setmeta \ @@ -242,46 +231,6 @@ find "$local_path" | grep -e 'index.html$' -e 'pdf$' | \ sed -e "s|^$local_path| http://$gs_path|" >> gerrit_comment.txt -- builder: - name: upload-generated-docs-to-opnfv-artifacts - builders: - - shell: | - #!/bin/bash - set -o errexit - set -o pipefail - set -o xtrace - export PATH=$PATH:/usr/local/bin/ - - [[ -d docs_output ]] || exit 0 - - echo - echo "########################" - echo "UPLOADING GENERATED DOCS" - echo "########################" - echo - - echo "gs_path="$GS_URL/docs"" - echo "local_path="upload/docs"" - - gs_path="$GS_URL/docs" - local_path="upload/docs" - - mkdir -p upload - mv docs_output "$local_path" - ls "$local_path" - - echo "gsutil -m cp -r "$local_path"/* "gs://$gs_path"" - gsutil -m cp -r "$local_path"/* "gs://$gs_path" - - gsutil -m setmeta \ - -h "Content-Type:text/html" \ - -h "Cache-Control:private, max-age=0, no-transform" \ - "gs://$gs_path"/**.html > /dev/null 2>&1 - - echo "Document link(s):" >> gerrit_comment.txt - find "$local_path" | grep -e 'index.html$' -e 'pdf$' | \ - sed -e "s|^$local_path| http://$gs_path|" >> gerrit_comment.txt - # To take advantage of this macro, have your build write # out the file 'gerrit_comment.txt' with information to post # back to gerrit and include this macro in the list of builders. @@ -431,19 +380,10 @@ - builder: name: upload-review-docs builders: - - build-html-and-pdf-docs-output - upload-under-review-docs-to-opnfv-artifacts - report-build-result-to-gerrit - builder: - name: upload-merged-docs - builders: - - build-html-and-pdf-docs-output - - upload-generated-docs-to-opnfv-artifacts - - report-build-result-to-gerrit - - remove-old-docs-from-opnfv-artifacts - -- builder: name: check-bash-syntax builders: - shell: "find . -name '*.sh' | xargs bash -n" @@ -459,23 +399,24 @@ export PATH=$PATH:/usr/local/bin/ # install python packages - pip install "yamllint==1.6.0" + sudo pip install "yamllint==1.8.2" # generate and upload lint log echo "Running yaml code on $PROJECT ..." + # Get list of yaml files + YAML_FILES=$(git --no-pager diff --diff-filter=MCRAT --name-only HEAD^1 | egrep "ya?ml$") + # Ensure we start with a clean environment rm -f yaml-violation.log lint.log - # Get number of yaml violations. If none, this will be an - # empty string: "" - find . \ - -type f -name "*.yml" -print \ - -o -name "*.yaml" -print | \ - xargs yamllint > yaml-violation.log || true + # Yamllint files only in patchset + for yamlfile in $YAML_FILES; do + yamllint $yamlfile >> yaml-violation.log || true + done if [ -s "yaml-violation.log" ]; then - SHOWN=$(cat yaml-violation.log| grep -v "^$" |wc -l) + SHOWN=$(grep -c -v "^$" yaml-violation.log) echo -e "First $SHOWN shown\n---" > lint.log cat yaml-violation.log >> lint.log sed -r -i '4,$s/^/ /g' lint.log diff --git a/jjb/global/slave-params.yml b/jjb/global/slave-params.yml index 0ea37d941..04de1e091 100644 --- a/jjb/global/slave-params.yml +++ b/jjb/global/slave-params.yml @@ -757,6 +757,21 @@ description: 'Git URL to use on this Jenkins Slave' - parameter: + name: zte-virtual6-defaults + parameters: + - node: + name: SLAVE_NAME + description: 'Slave name on Jenkins' + allowed-slaves: + - zte-virtual6 + default-slaves: + - zte-virtual6 + - string: + name: GIT_BASE + default: https://gerrit.opnfv.org/gerrit/$PROJECT + description: 'Git URL to use on this Jenkins Slave' + +- parameter: name: 'juniper-pod1-defaults' parameters: - node: diff --git a/jjb/opnfvdocs/docs-rtd.yaml b/jjb/opnfvdocs/docs-rtd.yaml index e15b09812..28f9354fa 100644 --- a/jjb/opnfvdocs/docs-rtd.yaml +++ b/jjb/opnfvdocs/docs-rtd.yaml @@ -38,6 +38,7 @@ files: 'docs/**/*.*' builders: + - 'remove-old-docs-from-opnfv-artifacts' - shell: | if [ $GERRIT_BRANCH == "master" ]; then RTD_BUILD_VERSION=latest @@ -91,4 +92,6 @@ pip install --upgrade pip pip freeze pip install tox + sed -i s,\-b\ html,\-b\ singlehtml,g tox.ini tox -edocs + - 'upload-review-docs' diff --git a/jjb/opnfvdocs/opnfvdocs.yml b/jjb/opnfvdocs/opnfvdocs.yml index 95bc8a9dd..3dfb9d155 100644 --- a/jjb/opnfvdocs/opnfvdocs.yml +++ b/jjb/opnfvdocs/opnfvdocs.yml @@ -11,7 +11,6 @@ jobs: - 'opnfvdocs-verify-shellcheck-{stream}' - 'opnfvdocs-merge-shellcheck-{stream}' - - 'opnfvdocs-daily-{stream}' stream: - master: @@ -109,31 +108,3 @@ builders: - check-bash-syntax - -- job-template: - name: 'opnfvdocs-daily-{stream}' - - disabled: true - - parameters: - - project-parameter: - project: '{project}' - branch: '{branch}' - - string: - name: GS_URL - default: '$GS_BASE{gs-pathname}' - description: "Directory where the build artifact will be located upon the completion of the build." - - string: - name: GIT_CLONE_BASE - default: ssh://gerrit.opnfv.org:29418 - description: "Used for overriding the GIT URL coming from parameters macro." - - scm: - - git-scm - - triggers: - - timed: '0 H/6 * * *' - - builders: - - build-html-and-pdf-docs-output -# - upload-generated-docs-to-opnfv-artifacts diff --git a/jjb/qtip/qtip-validate-jobs.yml b/jjb/qtip/qtip-validate-jobs.yml index febe28619..07f2431bc 100644 --- a/jjb/qtip/qtip-validate-jobs.yml +++ b/jjb/qtip/qtip-validate-jobs.yml @@ -40,6 +40,10 @@ installer: apex pod: zte-virtual5 <<: *euphrates + - compute: + installer: fuel + pod: zte-virtual6 + <<: *master # ------------------------------- # JOB LIST diff --git a/jjb/releng/functest-docker.yml b/jjb/releng/functest-docker.yml new file mode 100644 index 000000000..6c131604b --- /dev/null +++ b/jjb/releng/functest-docker.yml @@ -0,0 +1,268 @@ +--- +############################################## +# job configuration for docker build and push +############################################## +- project: + + name: functest-docker + + project: functest + + stream: + - master: + branch: '{stream}' + disabled: false + - euphrates: + branch: 'stable/{stream}' + disabled: false + + arch_tag: + - 'amd64': + slave_label: 'opnfv-build-ubuntu' + - 'arm64': + slave_label: 'opnfv-build-ubuntu-arm' + + # yamllint disable rule:key-duplicates + image: + - 'core' + - 'healthcheck' + - 'features' + - 'components' + - 'parser' + - 'smoke' + - 'vnf' + - 'restapi' + + # settings for jobs run in multijob phases + build-job-settings: &build-job-settings + current-parameters: false + git-revision: true + node-parameters: true + predefined-parameters: | + PUSH_IMAGE=$PUSH_IMAGE + COMMIT_ID=$COMMIT_ID + RELEASE_VERSION=$RELEASE_VERSION + DOCKERFILE=$DOCKERFILE + ARCH_TAG=$ARCH_TAG + kill-phase-on: FAILURE + abort-all-jobs: false + + manifest-job-settings: &manifest-job-settings + current-parameters: false + git-revision: true + node-parameters: true + predefined-parameters: | + RELEASE_VERSION=$RELEASE_VERSION + ARCH_TAG=$ARCH_TAG + kill-phase-on: FAILURE + abort-all-jobs: false + + # yamllint enable rule:key-duplicates + jobs: + - "functest-docker-build-push-{arch_tag}-{stream}" + - "functest-{image}-build-push-{arch_tag}-{stream}" + - "functest-{image}-create-manifest-{arch_tag}-{stream}" +######################## +# job templates +######################## +- job-template: + name: 'functest-docker-build-push-{arch_tag}-{stream}' + + project-type: multijob + + disabled: '{obj:disabled}' + + parameters: + - job-parameters: + project: '{project}' + branch: '{branch}' + slave_label: '{slave_label}' + arch_tag: '{arch_tag}' + - string: + name: ARCH_TAG + default: "{arch_tag}" + description: "If set, this value will be added to the docker image tag as a prefix" + + properties: + - throttle: + max-per-node: 1 + option: 'project' + + scm: + - git-scm + + triggers: + - pollscm: + cron: "*/30 * * * *" + + builders: + - multijob: + name: 'build-base-img-create-manifest' + execution-type: SEQUENTIAL + projects: + - name: 'functest-core-build-push-{arch_tag}-{stream}' + <<: *build-job-settings + - name: 'functest-core-create-manifest-{arch_tag}-{stream}' + <<: *manifest-job-settings + - multijob: + name: 'build-child-img' + condition: SUCCESSFUL + execution-type: PARALLEL + projects: + - name: 'functest-healthcheck-build-push-{arch_tag}-{stream}' + <<: *build-job-settings + - name: 'functest-features-build-push-{arch_tag}-{stream}' + <<: *build-job-settings + - name: 'functest-components-build-push-{arch_tag}-{stream}' + <<: *build-job-settings + - name: 'functest-parser-build-push-{arch_tag}-{stream}' + <<: *build-job-settings + - name: 'functest-smoke-build-push-{arch_tag}-{stream}' + <<: *build-job-settings + - name: 'functest-vnf-build-push-{arch_tag}-{stream}' + <<: *build-job-settings + - name: 'functest-restapi-build-push-{arch_tag}-{stream}' + <<: *build-job-settings + - multijob: + name: 'create-img-manifest' + condition: SUCCESSFUL + execution-type: PARALLEL + projects: + - name: 'functest-healthcheck-create-manifest-{arch_tag}-{stream}' + <<: *manifest-job-settings + - name: 'functest-features-create-manifest-{arch_tag}-{stream}' + <<: *manifest-job-settings + - name: 'functest-components-create-manifest-{arch_tag}-{stream}' + <<: *manifest-job-settings + - name: 'functest-parser-create-manifest-{arch_tag}-{stream}' + <<: *manifest-job-settings + - name: 'functest-smoke-create-manifest-{arch_tag}-{stream}' + <<: *manifest-job-settings + - name: 'functest-vnf-create-manifest-{arch_tag}-{stream}' + <<: *manifest-job-settings + - name: 'functest-restapi-create-manifest-{arch_tag}-{stream}' + <<: *manifest-job-settings + + publishers: + - 'functest-{arch_tag}-recipients' + +- job-template: + + name: 'functest-{image}-build-push-{arch_tag}-{stream}' + + disabled: '{obj:disabled}' + + parameters: + - job-parameters: + project: '{project}' + branch: '{branch}' + slave_label: '{slave_label}' + arch_tag: '{arch_tag}' + - string: + name: DOCKER_REPO_NAME + default: "opnfv/functest-{image}" + description: "Dockerhub repo to be pushed to." + - string: + name: DOCKER_DIR + default: "docker/{image}" + description: "Directory containing files needed by the Dockerfile" + + scm: + - git-scm + + publishers: + - 'functest-{arch_tag}-recipients' + + builders: + - shell: + !include-raw-escape: ./opnfv-docker.sh + +- job-template: + + name: 'functest-{image}-create-manifest-{arch_tag}-{stream}' + + disabled: '{obj:disabled}' + + parameters: + - job-parameters: + project: '{project}' + branch: '{branch}' + slave_label: '{slave_label}' + arch_tag: '{arch_tag}' + - string: + name: DOCKER_REPO_NAME + default: "opnfv/functest-{image}" + description: "Dockerhub repo to be pushed to." + - string: + name: DOCKER_DIR + default: "docker/{image}" + description: "Directory containing files needed by the Dockerfile" + + builders: + - shell: + !include-raw-escape: ./opnfv-manifest.sh + + scm: + - git-scm + + publishers: + - 'functest-{arch_tag}-recipients' + +# parameter macro +- parameter: + name: job-parameters + parameters: + - project-parameter: + project: '{project}' + branch: '{branch}' + - label: + name: SLAVE_LABEL + default: '{slave_label}' + description: 'Slave label on Jenkins' + - string: + name: GIT_BASE + default: https://gerrit.opnfv.org/gerrit/$PROJECT + description: 'Git URL to use on this Jenkins Slave' + - string: + name: PUSH_IMAGE + default: "true" + description: "To enable/disable pushing the image to Dockerhub." + - string: + name: COMMIT_ID + default: "" + description: "commit id to make a snapshot docker image" + - string: + name: RELEASE_VERSION + default: "" + description: "Docker tag to be built, e.g. 5.0.0, opnfv-5.0.0, 5.0.RC1" + - string: + name: DOCKERFILE + default: "Dockerfile" + description: "Dockerfile to use for creating the image." + - string: + name: ARCH_TAG + default: "{arch_tag}" + description: "If set, this value will be added to the docker image tag as a prefix" + - string: + name: PROJECT + default: "{project}" + description: "Project name used to enable job conditions" + +# publisher macros +- publisher: + name: 'functest-arm64-recipients' + publishers: + - email: + recipients: > + cristina.pauna@enea.com + alexandru.avadanii@enea.com + delia.popescu@enea.com + +- publisher: + name: 'functest-amd64-recipients' + publishers: + - email: + recipients: > + jalausuch@suse.com morgan.richomme@orange.com + cedric.ollivier@orange.com feng.xiaowei@zte.com.cn + juha.kosonen@nokia.com wangwulin@huawei.com diff --git a/jjb/releng/opnfv-docker-arm.yml b/jjb/releng/opnfv-docker-arm.yml index b488592db..3486a0775 100644 --- a/jjb/releng/opnfv-docker-arm.yml +++ b/jjb/releng/opnfv-docker-arm.yml @@ -40,7 +40,7 @@ other-receivers: &other-receivers receivers: '' - dockerfile: "Dockerfile.aarch64" + dockerfile: "Dockerfile" dockerdir: "docker" docker_repo_name: "opnfv/{project}_aarch64" arch_tag: "" @@ -59,7 +59,6 @@ - 'storperf-master': project: 'storperf' dockerdir: 'docker/storperf-master' - dockerfile: 'Dockerfile' docker_repo_name: 'opnfv/storperf-master' arch_tag: 'aarch64' <<: *master @@ -67,7 +66,6 @@ - 'storperf-graphite': project: 'storperf' dockerdir: 'docker/storperf-graphite' - dockerfile: 'Dockerfile' docker_repo_name: 'opnfv/storperf-graphite' arch_tag: 'aarch64' <<: *master @@ -75,7 +73,6 @@ - 'storperf-httpfrontend': project: 'storperf' dockerdir: 'docker/storperf-httpfrontend' - dockerfile: 'Dockerfile' docker_repo_name: 'opnfv/storperf-httpfrontend' arch_tag: 'aarch64' <<: *master @@ -83,7 +80,6 @@ - 'storperf-reporting': project: 'storperf' dockerdir: 'docker/storperf-reporting' - dockerfile: 'Dockerfile' docker_repo_name: 'opnfv/storperf-reporting' arch_tag: 'aarch64' <<: *master @@ -91,7 +87,6 @@ - 'storperf-swaggerui': project: 'storperf' dockerdir: 'docker/storperf-swaggerui' - dockerfile: 'Dockerfile' docker_repo_name: 'opnfv/storperf-swaggerui' arch_tag: 'aarch64' <<: *master @@ -112,7 +107,6 @@ - 'storperf-master': project: 'storperf' dockerdir: 'docker/storperf-master' - dockerfile: 'Dockerfile' docker_repo_name: 'opnfv/storperf-master' arch_tag: 'aarch64' <<: *euphrates @@ -120,7 +114,6 @@ - 'storperf-graphite': project: 'storperf' dockerdir: 'docker/storperf-graphite' - dockerfile: 'Dockerfile' docker_repo_name: 'opnfv/storperf-graphite' arch_tag: 'aarch64' <<: *euphrates @@ -128,7 +121,6 @@ - 'storperf-httpfrontend': project: 'storperf' dockerdir: 'docker/storperf-httpfrontend' - dockerfile: 'Dockerfile' docker_repo_name: 'opnfv/storperf-httpfrontend' arch_tag: 'aarch64' <<: *euphrates @@ -136,7 +128,6 @@ - 'storperf-reporting': project: 'storperf' dockerdir: 'docker/storperf-reporting' - dockerfile: 'Dockerfile' docker_repo_name: 'opnfv/storperf-reporting' arch_tag: 'aarch64' <<: *euphrates @@ -144,7 +135,6 @@ - 'storperf-swaggerui': project: 'storperf' dockerdir: 'docker/storperf-swaggerui' - dockerfile: 'Dockerfile' docker_repo_name: 'opnfv/storperf-swaggerui' arch_tag: 'aarch64' <<: *euphrates diff --git a/jjb/releng/opnfv-docker.sh b/jjb/releng/opnfv-docker.sh index 402099a91..c179b1d8e 100644 --- a/jjb/releng/opnfv-docker.sh +++ b/jjb/releng/opnfv-docker.sh @@ -54,20 +54,13 @@ if [[ -n "$(docker images | grep $DOCKER_REPO_NAME)" ]]; then done fi -cd $WORKSPACE/$DOCKER_DIR -HOST_ARCH=$(uname -m) -if [ ! -f "${DOCKERFILE}" ]; then - # If this is expected to be a Dockerfile for other arch than x86 - # and it does not exist, but there is a patch for the said arch, - # then apply the patch and create the Dockerfile.${HOST_ARCH} file - if [[ "${DOCKERFILE}" == *"${HOST_ARCH}" && \ - -f "Dockerfile.${HOST_ARCH}.patch" ]]; then - patch -o Dockerfile."${HOST_ARCH}" Dockerfile \ - Dockerfile."${HOST_ARCH}".patch - else - echo "ERROR: No Dockerfile or ${HOST_ARCH} patch found." - exit 1 - fi +cd "$WORKSPACE/$DOCKER_DIR" || exit 1 +HOST_ARCH="$(uname -m)" +#If there is a patch for other arch then x86, apply the patch and +#replace Dockerfile file +dockerfile_patch="Dockerfile.${HOST_ARCH}.patch" +if [[ -f "${dockerfile_patch}" ]]; then + patch -f Dockerfile -p1 < "${dockerfile_patch}" fi # Get tag version @@ -107,7 +100,6 @@ echo "Building docker image: $DOCKER_REPO_NAME:$DOCKER_TAG" echo "--------------------------------------------------------" echo cmd="docker build --no-cache -t $DOCKER_REPO_NAME:$DOCKER_TAG --build-arg BRANCH=$BUILD_BRANCH - $ARCH_BUILD_ARG -f $DOCKERFILE ." echo ${cmd} diff --git a/jjb/releng/opnfv-docker.yml b/jjb/releng/opnfv-docker.yml index 862e77ac8..8250bfea4 100644 --- a/jjb/releng/opnfv-docker.yml +++ b/jjb/releng/opnfv-docker.yml @@ -19,11 +19,6 @@ stream: euphrates branch: 'stable/{stream}' disabled: false - functest-receivers: &functest-receivers - receivers: > - jalausuch@suse.com morgan.richomme@orange.com - cedric.ollivier@orange.com feng.xiaowei@zte.com.cn - juha.kosonen@nokia.com wangwulin@huawei.com storperf-receivers: &storperf-receivers receivers: > mark.beierl@emc.com @@ -56,10 +51,6 @@ project: 'dovetail' <<: *master <<: *other-receivers - - 'functest': - project: 'functest' - <<: *master - <<: *functest-receivers - 'nfvbench': project: 'nfvbench' <<: *master @@ -116,10 +107,6 @@ project: 'bottlenecks' <<: *euphrates <<: *other-receivers - - 'functest': - project: 'functest' - <<: *euphrates - <<: *functest-receivers - 'storperf-master': project: 'storperf' dockerdir: 'docker/storperf-master' diff --git a/jjb/releng/opnfv-docs.yml b/jjb/releng/opnfv-docs.yml deleted file mode 100644 index 740274518..000000000 --- a/jjb/releng/opnfv-docs.yml +++ /dev/null @@ -1,115 +0,0 @@ ---- -######################## -# Job configuration for opnfv-docs -######################## -- project: - - name: opnfv-docs - - project: opnfv-docs - - jobs: - - 'opnfv-docs-verify-{stream}' - - 'opnfv-docs-merge-{stream}' - - stream: - - master: - branch: '{stream}' - doc-version: '' - gs-pathname: '' - disabled: false - - euphrates: - branch: 'stable/{stream}' - doc-version: '5.0.0' - gs-pathname: '/{stream}/{doc-version}' - disabled: false - -######################## -# job templates -######################## - -- job-template: - name: 'opnfv-docs-verify-{stream}' - - disabled: '{obj:disabled}' - - parameters: - - project-parameter: - project: $GERRIT_PROJECT - branch: '{branch}' - - scm: - - git-scm-gerrit - - triggers: - - gerrit: - server-name: 'gerrit.opnfv.org' - trigger-on: - - patchset-created-event: - exclude-drafts: 'false' - exclude-trivial-rebase: 'false' - exclude-no-code-change: 'false' - - draft-published-event - - comment-added-contains-event: - comment-contains-value: 'recheck' - - comment-added-contains-event: - comment-contains-value: 'reverify' - projects: - - project-compare-type: 'ANT' - project-pattern: '*' - branches: - - branch-compare-type: 'ANT' - branch-pattern: '**/{branch}' - file-paths: - - compare-type: ANT - pattern: docs/** - - compare-type: ANT - pattern: yardstick/** - - builders: - - upload-review-docs - -- job-template: - name: 'opnfv-docs-merge-{stream}' - - disabled: '{obj:disabled}' - - parameters: - - project-parameter: - project: $GERRIT_PROJECT - branch: '{branch}' - - string: - name: GS_URL - default: '$GS_BASE{gs-pathname}' - description: "Directory where the build artifact will be located upon the completion of the build." - - string: - name: GERRIT_REFSPEC - default: 'refs/heads/{branch}' - description: "JJB configured GERRIT_REFSPEC parameter" - - scm: - - git-scm - - triggers: - - gerrit: - server-name: 'gerrit.opnfv.org' - trigger-on: - - change-merged-event - - comment-added-contains-event: - comment-contains-value: 'remerge' - - comment-added-contains-event: - comment-contains-value: 'rebuild docs' - projects: - - project-compare-type: 'ANT' - project-pattern: '*' - branches: - - branch-compare-type: 'ANT' - branch-pattern: '**/{branch}' - file-paths: - - compare-type: ANT - pattern: docs/** - - compare-type: ANT - pattern: yardstick/** - - builders: - - upload-merged-docs diff --git a/jjb/releng/opnfv-manifest.sh b/jjb/releng/opnfv-manifest.sh new file mode 100755 index 000000000..a740491c2 --- /dev/null +++ b/jjb/releng/opnfv-manifest.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + + +set -o errexit +set -o nounset +set -o pipefail + +# Starting creating manifest image for $DOCKER_REPO_NAME + +ARCH=(amd64 arm64) +DOCKER_REPO_NAME=${DOCKER_REPO_NAME-} +RELEASE_VERSION=${RELEASE_VERSION-} +BRANCH=${BRANCH-} +ARCH_TAG=${ARCH_TAG-} + +# Before script install manifest-tool: +# cd .. && git clone https://github.com/estesp/manifest-tool +# cd ../manifest-tool && sudo -E make && sudo -E make install + +if [[ "$BRANCH" == "master" ]]; then + DOCKER_TAG="latest" +elif [[ "$BRANCH" == "euphrates" ]]; then + DOCKER_TAG="euphrates" +elif [[ -n "${RELEASE_VERSION}" ]]; then + DOCKER_TAG="${RELEASE_VERSION}" +else + DOCKER_TAG="stable" +fi +if [[ "${ARCH_TAG}" =~ "arm64" || "${ARCH_TAG}" =~ "amd64" ]]; then + sudo manifest-tool push from-args --platforms linux/amd64,linux/arm64 \ + --template "${DOCKER_REPO_NAME}":"${ARCH[0]}"-"${DOCKER_TAG}" \ + --template "${DOCKER_REPO_NAME}":"${ARCH[1]}"-"${DOCKER_TAG}" \ + --target "${DOCKER_REPO_NAME}":"${DOCKER_TAG}" +fi + diff --git a/jjb/releng/opnfv-repo-archiver.sh b/jjb/releng/opnfv-repo-archiver.sh index c9fdba379..2408c2a83 100644 --- a/jjb/releng/opnfv-repo-archiver.sh +++ b/jjb/releng/opnfv-repo-archiver.sh @@ -35,7 +35,7 @@ for PROJECT in "${PROJECT_LIST[@]}"; do # Don't license scan kernel or qemu in kvmfornfv if [ "$PROJECT" == "kvmfornfv" ]; then - rm -rf "$CLONE_PATH/$PROJECT/{kernel,qemu}" + rm -rf "$CLONE_PATH/$PROJECT/"{kernel,qemu} fi done diff --git a/utils/fetch_os_creds.sh b/utils/fetch_os_creds.sh index ac7595053..4bc585885 100755 --- a/utils/fetch_os_creds.sh +++ b/utils/fetch_os_creds.sh @@ -114,7 +114,7 @@ if [ "$installer_type" == "fuel" ]; then ssh ${ssh_options} "${ssh_user}@${controller_ip}" \ "sudo cat /root/keystonercv3" > "${dest_path}" - if [[ "${BUILD_TAG}" =~ "baremetal" ]]; then + if [[ ! "${BUILD_TAG}" =~ 'virtual' ]]; then ssh ${ssh_options} "${ssh_user}@${installer_ip}" \ "cat /etc/ssl/certs/os_cacert" > "${os_cacert}" fi diff --git a/utils/test/testapi/.gitignore b/utils/test/testapi/.gitignore index 21bb264e4..e34365e60 100644 --- a/utils/test/testapi/.gitignore +++ b/utils/test/testapi/.gitignore @@ -11,3 +11,5 @@ build .tox .ven docs/_build +opnfv_testapi/tests/UI/coverage +3rd_party/static/testapi-ui/testapi-ui
\ No newline at end of file diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/Gruntfile.js b/utils/test/testapi/3rd_party/static/testapi-ui/Gruntfile.js new file mode 100644 index 000000000..8ff280278 --- /dev/null +++ b/utils/test/testapi/3rd_party/static/testapi-ui/Gruntfile.js @@ -0,0 +1,155 @@ + +module.exports = function (grunt) { + require('load-grunt-tasks')(grunt); + require('grunt-protractor-coverage')(grunt); + grunt.loadNpmTasks('grunt-shell-spawn'); + grunt.loadNpmTasks('grunt-wait'); + grunt.loadNpmTasks('grunt-contrib-copy'); + grunt.loadNpmTasks('grunt-contrib-connect'); + grunt.initConfig({ + connect: { + server: { + options: { + port: 8000, + base: './', + middleware: function(connect, options, middlewares) { + middlewares.unshift(function(req, res, next) { + if (req.method.toUpperCase() == 'POST') req.method='GET'; + return next(); + }); + return middlewares; + } + } + } + }, + copy: { + assets: { + expand: true, + cwd: 'assets', + src: '**', + dest: 'testapi-ui/assets', + }, + components: { + expand: true, + cwd: 'components', + src: '**', + dest: 'testapi-ui/components', + }, + shared: { + expand: true, + cwd: 'shared', + src: '**', + dest: 'testapi-ui/shared', + }, + filesPng: { + expand: true, + src: '*.png', + dest: 'testapi-ui/', + }, + filesIco: { + expand: true, + src: '*.ico', + dest: 'testapi-ui/', + }, + filesJs: { + expand: true, + src: 'app.js', + dest: 'testapi-ui/', + }, + filesJson: { + expand: true, + src: 'config.json', + dest: 'testapi-ui/', + } + }, + wait: { + default: { + options: { + delay: 3000 + } + } + }, + shell: { + updateSelenium: { + command: 'node_modules/protractor/bin/webdriver-manager update', + options: { + async: false + } + }, + startSelenium: { + command: 'node_modules/protractor/bin/webdriver-manager start', + options: { + async: true + } + }, + options: { + stdout: false, + stderr: false + } + }, + instrument: { + files: ['components/**/*.js'], + options: { + lazy: false, + basePath: "./testapi-ui/" + } + }, + karma: { + unit: { + configFile: '../../../opnfv_testapi/tests/UI/karma.conf.js' + } + }, + protractor_coverage: { + options: { + keepAlive: true, + noColor: false, + coverageDir: '../../../opnfv_testapi/tests/UI/coverage', + args: { + specs: ['../../../opnfv_testapi/tests/UI/e2e/podsControllerSpec.js'] + } + }, + local: { + options: { + configFile: '../../../opnfv_testapi/tests/UI/protractor-conf.js' + } + } + }, + makeReport: { + src: '../../../opnfv_testapi/tests/UI/coverage/*.json', + options: { + print: 'detail' + } + }, + protractor: { + e2e: { + options: { + args: { + specs: ['../../../opnfv_testapi/tests/UI/e2e/podsControllerSpec.js'] + }, + configFile: '../../../opnfv_testapi/tests/UI/protractor-conf.js', + keepAlive: true + } + } + } + }); + grunt.registerTask('test', [ + 'karma:unit' + ]); + grunt.registerTask('e2e', [ + 'copy:assets', + 'copy:components', + 'copy:shared', + 'copy:filesPng', + 'copy:filesIco', + 'copy:filesJs', + 'copy:filesJson', + 'instrument', + 'connect', + 'shell:updateSelenium', + 'shell:startSelenium', + 'wait:default', + 'protractor_coverage', + 'makeReport' + // 'protractor' + ]); +} diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/package.json b/utils/test/testapi/3rd_party/static/testapi-ui/package.json new file mode 100644 index 000000000..dc992390d --- /dev/null +++ b/utils/test/testapi/3rd_party/static/testapi-ui/package.json @@ -0,0 +1,18 @@ +{ + "devDependencies": { + "grunt": "~1.0.1", + "grunt-contrib-connect": "^1.0.2", + "grunt-contrib-copy": "^1.0.0", + "grunt-karma": "~2.0.0", + "grunt-protractor-coverage": "^0.2.18", + "grunt-protractor-runner": "~5.0.0", + "grunt-shell-spawn": "~0.3.10", + "grunt-wait": "~0.1.0", + "karma": "~1.7.1", + "karma-chrome-launcher": "~2.2.0", + "karma-coverage": "~1.1.1", + "karma-jasmine": "~1.1.0", + "load-grunt-tasks": "~3.5.2", + "protractor-http-mock": "^0.10.0" + } +} diff --git a/utils/test/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js b/utils/test/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js new file mode 100644 index 000000000..66a57f2f2 --- /dev/null +++ b/utils/test/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js @@ -0,0 +1,188 @@ +'use strict'; + +var mock = require('protractor-http-mock'); +var baseURL = "http://localhost:8000" +describe('testing the Pods page for anonymous user', function () { + + beforeEach(function(){ + mock([{ + request: { + path: '/api/v1/pods', + method: 'GET' + }, + response: { + data: { + pods: [{role: "community-ci", name: "test", owner: "testUser", details: "DemoDetails", mode: "metal", _id: "59f02f099a07c84bfc5c7aed", creation_date: "2017-10-25 11:58:25.926168"}] + } + } + }]); + }); + + it( 'should navigate to pods link ', function() { + browser.get(baseURL); + var podslink = element(by.linkText('Pods')).click(); + var EC = browser.ExpectedConditions; + browser.wait(EC.urlContains(baseURL+ '/#/pods'), 10000); + }); + + it('create button is not visible for anonymous user', function () { + browser.get(baseURL+'#/pods'); + var buttonCreate = element(by.buttonText('Create')); + expect(buttonCreate.isDisplayed()).toBeFalsy(); + }); + + it('filter button is visible for anonymous user', function () { + var buttonFilter = element(by.buttonText('Filter')); + expect(buttonFilter.isDisplayed()).toBe(true) + }); + + it('clear button is visible for anonymous user', function () { + var buttonClear = element(by.buttonText('Clear')); + expect(buttonClear.isDisplayed()).toBe(true) + }); + + it('Show results when click filter button', function () { + var buttonFilter = element(by.buttonText('Filter')); + buttonFilter.click(); + var pod = element(by.css('.show-pod')); + expect(pod.isPresent()).toBe(true); + }); + + it('Show results when click clear button', function () { + browser.get(baseURL+'#/pods'); + var buttonClear = element(by.buttonText('Clear')); + buttonClear.click(); + var pod = element(by.css('.show-pod')); + expect(pod.isPresent()).toBe(true); + }); + + it('If details is not shown then show details when click the link',function() { + expect(element(by.css('.show-pod.hidden')).isPresent()).toBe(true); + var podslink = element(by.linkText('test')).click(); + expect(element(by.css('.show-pod.hidden')).isPresent()).toBe(false); + }); + + it('If details is shown then hide details when click the link',function() { + expect(element(by.css('.show-pod.hidden')).isPresent()).toBe(false); + var podslink = element(by.linkText('test')).click(); + expect(element(by.css('.show-pod.hidden')).isPresent()).toBe(true); + }); + + it('If backend is not responding then show error when click filter button', function () { + browser.get(baseURL + '/#/pods'); + mock.teardown(); + var buttonFilter = element(by.buttonText('Filter')); + buttonFilter.click().then(function(){ + expect(element(by.css('.alert.alert-danger.ng-binding.ng-scope')).isDisplayed()).toBe(true); + }); + }); + +}); + +describe('testing the Pods page for authorized user', function () { + + beforeEach(function(){ + mock([ + { + request: { + path: '/api/v1/pods', + method: 'POST' + }, + response: { + data: { + href: baseURL+"/api/v1/pods/test" + } + } + }, + { + request: { + path: '/api/v1/pods', + method: 'POST', + data: { + name: 'test1', + details : 'DemoDetails', + role : 'community-ci', + mode : 'metal' + } + }, + response: { + status : 403 + } + }, + { + request: { + path: '/api/v1/profile', + method: 'GET' + }, + response: { + data: { + "fullname": "Test User", "_id": "79f82eey9a00c84bfhc7aed", "user": "testUser", "groups": ["opnfv-testapi-users"], "email": "testuser@test.com" + } + } + } + ]); + }); + + it('create button is visible for authorized user', function () { + browser.get(baseURL + '/#/pods'); + var buttonCreate = element(by.buttonText('Create')); + expect(buttonCreate.isDisplayed()).toBe(true); + }); + + it('Do not show error if input is acceptable', function () { + var name = element(by.model('ctrl.name')); + var details = element(by.model('ctrl.details')); + name.sendKeys('test'); + details.sendKeys('DemoDetails'); + var buttonCreate = element(by.buttonText('Create')); + buttonCreate.click().then(function(){ + expect(element(by.css('.alert.alert-danger.ng-binding.ng-scope')).isDisplayed()).toBe(false); + }); + }); + + it('Show error when user click the create button with a empty name', function () { + browser.get(baseURL+ '/#/pods'); + var details = element(by.model('ctrl.details')); + details.sendKeys('DemoDetails'); + var buttonCreate = element(by.buttonText('Create')); + buttonCreate.click(); + expect(element(by.cssContainingText(".alert","Name is missing.")).isDisplayed()).toBe(true); + }); + + it('Show error when user click the create button with an already existing name', function () { + browser.get(baseURL+ '/#/pods'); + var name = element(by.model('ctrl.name')); + var details = element(by.model('ctrl.details')); + name.sendKeys('test1'); + details.sendKeys('DemoDetails'); + var buttonCreate = element(by.buttonText('Create')); + buttonCreate.click(); + expect(element(by.cssContainingText(".alert","Error creating the new pod from server: Pod's name already exists")).isDisplayed()).toBe(true); + }); + + it('If backend is not responding then show error when user click the create button',function(){ + mock.teardown(); + mock([ + { + request: { + path: '/api/v1/profile', + method: 'GET' + }, + response: { + data: { + "fullname": "Test User", "_id": "79f82eey9a00c84bfhc7aed", "user": "testUser", "groups": ["opnfv-testapi-users"], "email": "testuser@test.com" + } + } + } + ]); + browser.get(baseURL+ '/#/pods'); + var name = element(by.model('ctrl.name')); + var details = element(by.model('ctrl.details')); + name.sendKeys('test'); + details.sendKeys('DemoDetails'); + var buttonCreate = element(by.buttonText('Create')); + buttonCreate.click().then(function(){ + expect(element(by.css('.alert.alert-danger.ng-binding.ng-scope')).isDisplayed()).toBe(true); + }); + }) +});
\ No newline at end of file diff --git a/utils/test/testapi/opnfv_testapi/tests/UI/karma.conf.js b/utils/test/testapi/opnfv_testapi/tests/UI/karma.conf.js new file mode 100644 index 000000000..eaded5a1d --- /dev/null +++ b/utils/test/testapi/opnfv_testapi/tests/UI/karma.conf.js @@ -0,0 +1,14 @@ +module.exports = function (config) { + config.set({ + frameworks: ['jasmine'], + files: [ + "assets/lib/angular/angular.js", + "assets/lib/angular-mocks/angular-mocks.js", + ], + autoWatch: true, + browsers: ['Chrome'], + singleRun: true, + reporters: ['progress', 'coverage'], + preprocessors: { 'src/*.js': ['coverage'] } + }); +}; diff --git a/utils/test/testapi/opnfv_testapi/tests/UI/protractor-conf.js b/utils/test/testapi/opnfv_testapi/tests/UI/protractor-conf.js new file mode 100644 index 000000000..affbe5d26 --- /dev/null +++ b/utils/test/testapi/opnfv_testapi/tests/UI/protractor-conf.js @@ -0,0 +1,18 @@ +exports.config = { + seleniumAddress: 'http://localhost:4444/wd/hub', + capabilities: { + 'browserName': 'chrome', + 'chromeOptions': { + 'args': ['show-fps-counter=true', '--disable-web-security', "no-sandbox", "--headless", "--disable-gpu"] + } + }, + jasmineNodeOpts: { + showColors: true, + defaultTimeoutInterval: 30000 + }, + onPrepare: function(){ + require('protractor-http-mock').config = { + rootDirectory: __dirname + }; + } +}; |