Skip to content

Commit

Permalink
Updated linter to githubs superlinter (#51)
Browse files Browse the repository at this point in the history
* Updated linter to githubs superlinter

* superlinter: specified config location

* superlinter: fixed README and Dockerfile

* superlinter: allowing ? in headers

* superlinter: fixed dockerfile

* superlinter: updated python version matrix

* fixed Dockerfile

* Markdown lint rules

* superlinter: python

* superlinter: remove isort special rules

* superlinter: isort fix
  • Loading branch information
Fabian Siegel authored Nov 10, 2020
1 parent f5f24bf commit c114fb5
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 67 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package
name: Python Lints and Tests

on: [push, pull_request]

Expand All @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
Expand All @@ -24,12 +24,13 @@ jobs:
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --statistics
- name: Lint Code Base
uses: github/super-linter@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_PYTHON_PYLINT: false
LINTER_RULES_PATH: .
PYTHON_BLACK_CONFIG_FILE: pyproject.toml
- name: Run pluploader --version
run: |
pip install .
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM python:3.8

ARG PL_VERSION
ARG PL_VERSION=">=0.3"

RUN mkdir /workdir

RUN pip3 install pluploader==$PL_VERSION
RUN pip3 install "pluploader==$PL_VERSION"

WORKDIR /workdir

ENTRYPOINT [ "pluploader" ]%
ENTRYPOINT [ "pluploader" ]
93 changes: 53 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
## pluploader
<!-- markdownlint-configure-file
{
"no-bare-urls": false,
"no-trailing-punctuation": false,
"line-length": false
}
-->

# pluploader

![PyPI version](https://img.shields.io/pypi/v/pluploader?style=flat-square) ![Upload Python Package](https://img.shields.io/github/workflow/status/livelyapps/pluploader/Python%20package/master?style=flat-square)

A simple command line plugin uploader/installer/manager for atlassian product
A simple command line plugin uploader/installer/manager for atlassian product
server instances (Confluence/Jira) written in python(3).

## Installation
Expand All @@ -11,7 +19,7 @@ Regulary tested on Linux (Arch Linux), MacOS and Windows 10.

### pip (recommended)

```
```bash
pip3 install pluploader
```

Expand All @@ -28,18 +36,20 @@ docker pull docker.pkg.github.com/livelyapps/pluploader/pluploader:latest

pluploader can then be run by executing

```
```bash
docker run -v "$(pwd)":/workdir -it craftamap/pluploader:v0.4.1
```

## Usage

For a in-depth explanation, see `pluploader --help`

> ℹ This documentation describes the master branch, and not (necessarily) the latest release.
### Global Options

You can specify various global options:

- `--base-url <base-url>`, default: `http://localhost:8090`
- `--user <username>`, default: `admin`
- `--password <password>`, default: `admin`
Expand All @@ -54,40 +64,40 @@ All Global Options can be overwritten by using a configuration file. See more in

If you are in a maven project, the basic usage is fairly simple. Just type:

```
```bash
pluploader --user admin --password admin
```

The pluploader then uploads and enables the current artifact specified in the
The pluploader then uploads and enables the current artifact specified in the
pom.xml

If you are not in a maven directory currently, but you want to upload a specific
file, you can also use the `-f plugin.jar` flag.

If you want to confirm your upload, you can also use the `-i` /
If you want to confirm your upload, you can also use the `-i` /
`--interactive` flag.

It is recommended to use the pluploader with maven. The usage looks like:

```
```bash
atlas-mvn clean package && pluploader
```

#### Installing apps from the marketplace

pluploader supports downloading apps from the atlassian marketplace to your local
pluploader supports downloading apps from the atlassian marketplace to your local
machine and installing them afterwards. You need to supply either `--mpac-key`,
which is the normal addon-key, or `--mpac-id` (experimental), which is the
which is the normal addon-key, or `--mpac-id` (experimental), which is the
numeric id of an marketplace id (72307 https://marketplace.atlassian.com/apps/72307)

```
```bash
pluploader --mpac-key com.atlassian.confluence.extra.team-calendars
```

**NOTE**:
**NOTE**:
If you specify one of the global options, you need to add the `install`-command:

```
```bash
pluploader --base-url https://your-confluence.com:8090 install
```

Expand All @@ -110,7 +120,7 @@ indicates that the plugin is disabled.
In order to retrieve more information about a specific plugin, you can use the
command `info`.

```
```bash
pluploader info com.example.plugin.key
```

Expand All @@ -124,19 +134,20 @@ The commands `enable`, `disable` or `uninstall` follow the same syntax.
pluploader also supports disabling or enabling all apps using Safe Mode.

To retrieve the status if safe-mode is enabled at the moment, use
```

```bash
pluploader safe-mode status
```

You can enable and disable safe mode by using
You can enable and disable safe mode by using

```
```bash
pluploader safe-mode enable
```

And

```
```bash
pluploader safe-mode disable
# OR
pluploader safe-mode disable --keep-state
Expand All @@ -148,7 +159,7 @@ You can also use the pluploader to get and set licenses for your plugins.

To get the current license information:

```
```bash
pluploader license info com.example.plugin.key
```

Expand All @@ -159,17 +170,17 @@ pluploader license update com.example.plugin.key --license "AAA..."
```

> ℹ Pro tip: Use `xargs` to read a license from a file by using
>
>
> ```bash
> cat license.txt | xargs pluploader license update --license
> cat license.txt | xargs pluploader license update --license
> ```
You can also apply [timebomb licenses](https://developer.atlassian.com/platform/marketplace/timebomb-licenses-for-testing-server-apps/)
by using
```bash
pluploader license timebomb com.example.plugin.key --timebomb threehours
pluploader license timebomb com.example.plugin.key --timebomb threehours
```
You can choose between 3 hours (threehours), 60 seconds (sixtyseconds) and
Expand All @@ -178,66 +189,68 @@ You can choose between 3 hours (threehours), 60 seconds (sixtyseconds) and
To remove an applied license, you can use:

```bash
pluploader license delete com.example.plugin.key
pluploader license delete com.example.plugin.key
```

### Scheduled Jobs (Confluence - Experimental)

> ℹ This feature is currently experimental and only works in specific version of
> ℹ This feature is currently experimental and only works in specific version of
> Confluence (tested on Confluence 7.5).
Pluploader can also be used to retrieve information about confluence jobs and
execute them.

You can grab a list of all jobs by running

```
```bash
pluploader job list
```

Available options are:
- `--hide-default` - Hides confluence internal jobs
- `--print-all-infos` - print more informations
Available options are:

- `--hide-default` - Hides confluence internal jobs
- `--print-all-infos` - print more informations

You can also run jobs by running

```
```bash
pluploader job run
```

Get more information about a job by running

```
```bash
pluploader job info
```

And disable or enable jobs by running
```
pluploader job enable

```bash
pluploader job enable
# AND
pluploader job disable
```

A job can be specified by either using `--id <job id>` or by using
`--idx <job index in list>`. If no job is specified, you will be asked
A job can be specified by either using `--id <job id>` or by using
`--idx <job index in list>`. If no job is specified, you will be asked
interactively.

### Configuration

If you don't want to write the username or password (or any other global
parameter) each time, you can use a filed called `.pluprc`, either placed in
your current maven project or/and in your home directory. A example looks like
If you don't want to write the username or password (or any other global
parameter) each time, you can use a filed called `.pluprc`, either placed in
your current maven project or/and in your home directory. A example looks like
this:

```
```bash
base_url: https://example.com:8090
user: admin
password: admin
```

### Environment variables

You can also specify username, password and base url by using `PLUP_USER`,
You can also specify username, password and base url by using `PLUP_USER`,
`PLUP_PASSWORD` and `PLUP_BASEURL`.

## Development
Expand All @@ -248,7 +261,7 @@ pluploader uses [poetry](https://python-poetry.org/) as it's package manager. As

### Why would I use the pluploader over X?

Of course, you can use whatever tool you want to.
Of course, you can use whatever tool you want to.

### Why would I use the pluploader over the UPM?

Expand Down
6 changes: 1 addition & 5 deletions pluploader/confluence/jobs/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,7 @@ def disable_job(self, job: Job, token: typing.Optional[str] = None,) -> bool:
response = self.session.get(request_url)
return response.status_code == 200

def enable_job(
self,
job: Job,
token: typing.Optional[str] = None,
) -> bool:
def enable_job(self, job: Job, token: typing.Optional[str] = None,) -> bool:
if token is None:
token = self.get_token()
request_url = self.base_url.copy()
Expand Down
5 changes: 3 additions & 2 deletions pluploader/job.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import logging
import shutil
import sys
import typing

import requests
import typer
import typing
from colorama import Fore

from .confluence.jobs import jobs
from .confluence.jobs.jobs import JobsScraper
from colorama import Fore

app_job = typer.Typer()

Expand Down
2 changes: 1 addition & 1 deletion pluploader/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
from .mpac import download
from .mpac.exceptions import MpacAppNotFoundError, MpacAppVersionNotFoundError
from .safemode import app_safemode
from .upm.upmcloudapi import UpmCloudApi
from .upm.upmapi import UpmApi
from .upm.upmcloudapi import UpmCloudApi
from .util import atlassian_jar as jar
from .util import pathutil

Expand Down
3 changes: 1 addition & 2 deletions pluploader/mpac/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import requests
from furl import furl

from . import scraper
from . import rest
from . import rest, scraper


def _download_file_to_tmp_dir(url: furl) -> os.PathLike:
Expand Down
3 changes: 2 additions & 1 deletion pluploader/mpac/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"""

import dataclasses
import typing

import requests
import typing
from furl import furl

from .exceptions import MpacAppVersionNotFoundError

BASE_URL = furl("https://marketplace.atlassian.com/rest/2")
Expand Down
3 changes: 2 additions & 1 deletion pluploader/mpac/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import requests
from bs4 import BeautifulSoup
from furl import furl
from .exceptions import (MpacAppNotFoundError, MpacAppVersionNotFoundError)

from .exceptions import MpacAppNotFoundError, MpacAppVersionNotFoundError

VERSION_HISTORY_URL = "https://marketplace.atlassian.com/apps/{}/WILDCARD/version-history"

Expand Down
7 changes: 4 additions & 3 deletions pluploader/safemode.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import typer
from colorama import Fore
import logging
import requests
import sys

import requests
import typer
from colorama import Fore

from .upm.upmapi import UpmApi

app_safemode = typer.Typer()
Expand Down
Loading

0 comments on commit c114fb5

Please sign in to comment.