Skip to content

Commit

Permalink
Bump version to 0.0.9 (#47)
Browse files Browse the repository at this point in the history
* Bump version to v0.0.9-dev

* Bump version to v0.0.9-dev

* Update github-registry-install.md

* Update workflow files

* Update workflow files

* Update workflow files

* Update workflow files

* Update workflow files

* Add Attest Build Provenance action

* Update workflow files

* Added instructions for updating the bot's image to the inline action.

* Update README.md

* Fix import error

* Fix ValueError

* Update update_info.py

* The return of support for publishing images on hub.docker.com

* Refactoring code

* The beginning of the transition to the terms of documentation according to the standard

* Changing the architecture of handlers classes from abstract to inherited

* Update deps

* Fixed the import of the bot logger.

* Refactoring loggers message format

* Refactoring loggers message format

* Fix dockstring

* Update deps

* Fix ValueError

* Update deps

* Added new handlers: Network and About me

* Remove unused variable 'main_keyboard'

* Remove unused start statement

* Refactoring code; create docstring and comments

* Remove unused import

* Refactoring code

* Refactoring code

* Refactoring code

* Fixed no method error

* Refactoring code

* Revert change - needed testing new code

* Refactoring code

* Refactoring code

* Refactoring code

* Refactoring code

* Refactoring code

* Update deps

* Refactoring code

* Refactoring code

* I am beginning to implement tests.

* Refactoring About bot handler

* Update dependency

* Deleted the action to create the image from the dev branch

* Refactoring Check bot update handler

* Refactoring auth middleware

* Update docs

* Update docs

* Refactoring code

* Bump version to 0.0.9 release
  • Loading branch information
orenlab authored Jun 7, 2024
1 parent 128368c commit 8822c79
Show file tree
Hide file tree
Showing 57 changed files with 3,481 additions and 1,273 deletions.
98 changes: 0 additions & 98 deletions .github/workflows/dev-docker-ci.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/dev-image-build-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Push Alpine Dev Image

on:
push:
branches:
- 'development'

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
build-args: --target prod
file: hub.Dockerfile
push: true
tags: orenlab/pytmbot:alpine-dev
38 changes: 12 additions & 26 deletions .github/workflows/prod-docker-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ name: Production Docker CI

on:
schedule:
- cron: '16 5 * * *'
- cron: '16 1 * * *'
release:
types: [ published ]
tags: [ 'v*.*.*' ]


env:
Expand Down Expand Up @@ -39,39 +38,41 @@ jobs:
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@v3.3.0
uses: sigstore/cosign-installer@v3.5.0
with:
cosign-release: 'v2.2.2'
cosign-release: 'v2.2.4'
- name: Check install!
run: cosign version

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- name: Docker Setup Buildx
uses: docker/setup-buildx-action@v3.3.0

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
uses: docker/login-action@v3.2.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.PACKAGE_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
- name: Docker Metadata action
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
uses: docker/metadata-action@v5.5.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
uses: docker/build-push-action@v5.3.0
with:
context: .
build-args: --target prod
Expand All @@ -80,19 +81,4 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
TAGS: ${{ steps.meta.outputs.tags }}
DIGEST: ${{ steps.build-and-push.outputs.digest }}
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
cache-to: type=gha,mode=max
40 changes: 40 additions & 0 deletions .github/workflows/release-to-docker-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Push Release image to Docker registry

on:
release:
types: [ published ]

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ github.repository }}

- name: Build and push Docker image
id: push
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
build-args: --target prod
file: hub.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion .run/Dockerfile.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<settings>
<option name="imageTag" value="dev-latest-loc"/>
<option name="buildCliOptions" value="--target selfbuild_dev"/>
<option name="command" value=""/>
<option name="containerName" value="pytmbot"/>
<option name="commandLineOptions" value=""/>
<option name="sourceFilePath" value="Dockerfile"/>
<option name="volumeBindings">
<list>
Expand Down
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,23 @@ gather information.
- Uptime information
- File system base information
- Containers (so far, only Docker and only on Linux) base information
- Ability to check for bot software updates: `/check_bot_updates` (Available in the alpine-dev version)
- `Jinja2` is used for creating templates.
- Bot logs are available in the Docker logging system.
- Emoji are used :)
- Basic information about the network connection

### 🔖 Additionally:

- The "About Me" section, which allows users to check for updates regarding the bot: `/check_bot_updates`
- The `Jinja2` templating engine is used to generate the responses.
- The bot logs are accessible in the Docker log aggregator.
- And of course we use emoji 😅

Screenshots are available here: [screenshots.md](docs/screenshots.md).
Video demo see in YouTube Shorts [here](https://youtube.com/shorts/81RE_PNjxLQ?feature=shared)

## 🕸 Requirements

Initially, the bot was designed to ensure its correct operation only within the Docker container. I have not tested it
running on a local system, either inside or outside a virtual environment.
Therefore, please make sure that Docker is installed on your system.
Initially, I designed the bot to run only inside a Docker container. However, this method has some limitations, so from
version 0.9.0 onward, it is possible to install the bot locally outside the container. At the same time, the bot will
still be able to function and receive information about Docker containers.

Full list of Python dependencies see in `requirements.txt`

Expand Down Expand Up @@ -78,6 +82,7 @@ All failed attempts to authorize are logged with an `ERROR` flag.
│ │ │ ├── __init__.py
│ │ │ ├── default_handlers
│ │ │ │ ├── __init__.py - Import all defaults handlers
│ │ │ │ ├── about_bot.py - About bot handler
│ │ │ │ ├── check_bot_update.py - Check pyTMbot updates
│ │ │ │ ├── containers_handler.py - Container handler
│ │ │ │ ├── fs_handler.py - Filesystem handler
Expand All @@ -92,6 +97,7 @@ All failed attempts to authorize are logged with an `ERROR` flag.
│ │ │ └── inline_handlers
│ │ │ ├── __init__.py
│ │ │ └── swap_handler.py - Swap inline handler
│ │ │ └── update_info.py - Updates info inline handler
│ │ ├── jinja2
│ │ │ ├── __init__.py
│ │ │ └── jinja2.py - Main jinja2 class
Expand All @@ -109,9 +115,11 @@ All failed attempts to authorize are logged with an `ERROR` flag.
│ │ └── loggers.py - Logger templates
│ ├── main.py - Main bot class
│ ├── templates
│ │ ├── about_bot.jinja2 - Bot update jinja2 template
│ │ ├── bot_update.jinja2 - Bot update jinja2 template
│ │ ├── containers.jinja2 - Containers jinja2 template
│ │ ├── fs.jinja2 - Filesystem jinja2 template
│ │ ├── how_update.jinja2 - Update instruction jinja2 template
│ │ ├── index.jinja2 - Start jinja2 template
│ │ ├── load_average.jinja2 - Load average jinja2 template
│ │ ├── memory.jinja2 - Memory jinja2 template
Expand All @@ -138,8 +146,7 @@ All failed attempts to authorize are logged with an `ERROR` flag.
├── requirements.txt - Requirements for build Docker image
├── setup_bot.py - Initial setup bot script
├── setup_req.txt - Setup requirements
├── tests
│ └── bot_tests.py - Bots tests
├── tests - Bot tests
```

## 📈 Roadmap
Expand Down
1 change: 1 addition & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

| Version | Supported |
|---------|--------------------|
| 0.0.9 | :white_check_mark: |
| 0.0.8 | :white_check_mark: |
| < 0.0.8 | :x: |

Expand Down
Loading

0 comments on commit 8822c79

Please sign in to comment.