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

Changes for an initial collection to get certified by RedHat #1

Merged
merged 2 commits into from
Sep 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.py text eol=lf
*.sh text eol=lf
*.yml text eol=lf
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### Scenario/Intent
[What you are trying to achieve but can't?]

### Environment Details
- **Module Version:** [Version of the Oneview-Ansible module for which you are encountering the issue]
- **Ansible Version:** [Version of Ansible for which you are encountering the issue]
- **OneView Appliance Version:** [Version of the OneView appliance you're interacting with]
- **OneView Client API Version:** [API version listed in your configuration file or dictionary]
- **Python Version:** [Version of Python in your environment]
- **python-hpOneView SDK Version:** [Version of the python-hpOneView SDK in your environment]
- **Platform:** [OS distribution and release version]

### Steps to Reproduce
[What are the complete steps needed to do in order to reproduce your problem?]

### Expected Result
[What do you *expect* to happen after taking the steps above?]

### Actual Result
[What *actually* happens after the steps above? Include error output or a link to a gist.]
11 changes: 11 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### Description
[Describe what this change achieves]

### Issues Resolved
[List any issues this PR will resolve. e.g., Fixes #01]

### Check List
- [ ] New functionality includes testing.
- [ ] All tests pass. (`$ ./build.sh`).
- [ ] New functionality has been documented in the README if applicable.
- [ ] New functionality has been thoroughly documented in the examples (please include helpful comments).
42 changes: 42 additions & 0 deletions .github/workflows/.ansible-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI
on:
- pull_request

jobs:
sanity:
name: Sanity (${{ matrix.ansible }})
strategy:
matrix:
python_version:
- 3.6
ansible:
- stable-2.10
- devel
runs-on: ubuntu-latest
steps:

- name: Check out code
uses: actions/checkout@v1
with:
path: ansible_collections/hpe/oneview

- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v1
with:
python-version: 3.6

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install future
if [ -f test_requirements.txt ]; then pip install -r test_requirements.txt; fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

- name: Install ansible-base (${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check

- name: Install ansible_collections.hpe.oneview
run: ansible-galaxy collection install hpe.oneview -p ../../

- name: Run sanity tests
run: ansible-test sanity --docker -v --color --python ${{ matrix.python_version }}
31 changes: 31 additions & 0 deletions .github/workflows/.release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Upload release to Galaxy

on:
release:
types: [created]

jobs:
release:
runs-on: ubuntu-latest
env:
ANSIBLE_GALAXY_TOKEN: ${{ secrets.ANSIBLE_GALAXY_TOKEN }}
steps:
- name: Check out code
uses: actions/checkout@v1

- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: '3.6'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ansible

- name: Build and publish
env:
ANSIBLE_GALAXY_API_KEY: ${{ secrets.ANSIBLE_GALAXY_API_KEY }}
run: |
ansible-galaxy collection build .
ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY
54 changes: 54 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
###
# Copyright (2016-2017) Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###
language: python
python:
- 2.7
- 3.5
env:
- ANSIBLE=2.1 PYPI_VERSION='2.1.5.0'
- ANSIBLE=2.2 PYPI_VERSION='2.2.2.0'
- ANSIBLE=2.3 PYPI_VERSION='2.3.0.0'
- ANSIBLE=2.4 PYPI_VERSION='2.4.0.0'
- ANSIBLE=src-2.4 BRANCH='stable-2.4' # source code is required to run the sanity test validate-modules
matrix:
exclude:
- python: 3.5
env: ANSIBLE=2.1 PYPI_VERSION='2.1.5.0'
- python: 3.5
env: ANSIBLE=2.2 PYPI_VERSION='2.2.2.0'
install:
- if [[ $PYPI_VERSION ]]; then pip install ansible==$PYPI_VERSION; fi
- pip install flake8
- pip install mock
- pip install git+https://github.com/HewlettPackard/oneview-python.git
- pip install coveralls
- pip install hpICsp
- |
if [[ $ANSIBLE == 2.1 || $ANSIBLE == 2.2 ]]; then
pip install git+https://github.com/sivel/ansible-testing.git#egg=ansible_testing;
fi
before_script:
- |
if [[ $BRANCH ]]; then
git clone -b $BRANCH --single-branch https://github.com/ansible/ansible.git;
source ./ansible/hacking/env-setup;
pip install pyyaml jinja2 nose pytest passlib pycrypto six voluptuous;
fi
script:
- export ANSIBLE_LIBRARY=$PWD/library
- export PYTHONPATH=$ANSIBLE_LIBRARY:$PYTHONPATH
- touch examples/vars/config.yml
- ./build.sh
74 changes: 74 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Contribution Guide

We welcome and encourage community contributions to oneview-ansible.

## Contributing

The best way to directly collaborate with the project contributors is through GitHub: <https://github.com/HewlettPackard/oneview-ansible>

* If you want to contribute to our code by either fixing a problem or creating a new feature, please open a GitHub pull request.
* If you want to raise an issue such as a defect, an enhancement request or a general issue, please open a GitHub issue.

Before you start to code, we recommend discussing your plans through a GitHub issue, especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing.

Note that all patches from all contributors get reviewed.
After a pull request is made, other contributors will offer feedback. If the patch passes review, a maintainer will accept it with a comment.
When a pull request fails review, the author is expected to update the pull request to address the issue until it passes review and the pull request merges successfully.

At least one review from a maintainer is required for all patches.

### Developer's Certificate of Origin

All contributions must include acceptance of the DCO:

> Developer Certificate of Origin Version 1.1
>
> Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 660
> York Street, Suite 102, San Francisco, CA 94110 USA
>
> Everyone is permitted to copy and distribute verbatim copies of this
> license document, but changing it is not allowed.
>
> Developer's Certificate of Origin 1.1
>
> By making a contribution to this project, I certify that:
>
> \(a) The contribution was created in whole or in part by me and I have
> the right to submit it under the open source license indicated in the
> file; or
>
> \(b) The contribution is based upon previous work that, to the best of my
> knowledge, is covered under an appropriate open source license and I
> have the right under that license to submit that work with
> modifications, whether created in whole or in part by me, under the same
> open source license (unless I am permitted to submit under a different
> license), as indicated in the file; or
>
> \(c) The contribution was provided directly to me by some other person
> who certified (a), (b) or (c) and I have not modified it.
>
> \(d) I understand and agree that this project and the contribution are
> public and that a record of the contribution (including all personal
> information I submit with it, including my sign-off) is maintained
> indefinitely and may be redistributed consistent with this project or
> the open source license(s) involved.

### Sign your work

To accept the DCO, simply add this line to each commit message with your
name and email address (git commit -s will do this for you):

Signed-off-by: Jane Example <jane@example.com>

For legal reasons, no anonymous or pseudonymous contributions are
accepted.

## Submitting Code Pull Requests

We encourage and support contributions from the community. No fix is too
small. We strive to process all pull requests as soon as possible and
with constructive feedback. If your pull request is not accepted at
first, please try again after addressing the feedback you received.

To make a pull request you will need a GitHub account. For help, see
GitHub's documentation on forking and pull requests.
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM python:3.6-slim-buster

LABEL maintainer "Chebrolu Harika <bala-sai-harika.chebrolu@hpe.com>"

WORKDIR /root

# Some optional but recommended packages
RUN DEBIAN_FRONTEND=noninteractive \
apt-get update -y \
&& apt-get install --no-install-recommends -y \
vim \
curl \
ansible

RUN pip install pyOpenSSL hpOneView

ADD . oneview-ansible/

WORKDIR /root/oneview-ansible

# Adding hosts for convenience
RUN mkdir -p /etc/ansible
RUN echo [localhost] >> /etc/ansible/hosts
RUN echo localhost ansible_python_interpreter=python3 ansible_connection=local >> /etc/ansible/hosts

# packages to run tests
RUN cd /root/oneview-ansible/
RUN pip install -r test_requirements.txt

ENV ANSIBLE_LIBRARY=/root/oneview-ansible/library
ENV ANSIBLE_MODULE_UTILS=/root/oneview-ansible/library/module_utils/

# Clean and remove not required packages
RUN DEBIAN_FRONTEND=noninteractive \
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/cache/apt/archives/* /var/cache/apt/lists/* /tmp/* /root/cache/.

CMD [ "ansible-playbook", "--version" ]
Loading