Skip to content
This repository has been archived by the owner on Apr 29, 2023. It is now read-only.

Commit

Permalink
Merge branch 'feature/migrate-to-actions' into 3.8.314
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew-Beckett committed May 22, 2021
2 parents 315813b + c763300 commit b40fa61
Show file tree
Hide file tree
Showing 13 changed files with 159 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ updates:
directory: "/nxagent" # Location of package manifests
schedule:
interval: "daily"
- package-ecosystem: "pip" # See documentation for possible values
directory: "/.gitlab/scripts/collect_container_images" # Location of package manifests
schedule:
interval: "daily"
73 changes: 73 additions & 0 deletions .github/workflows/dockerimage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Build Docker Images

on: [push]

jobs:

WebUI:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
name: Checkout repository

- uses: mr-smithers-excellent/docker-build-push@v5
name: Build & push Web UI
with:
image: netxms_webui
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
dockerfile: webui/Dockerfile

WebUIREST:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
name: Checkout repository

- uses: mr-smithers-excellent/docker-build-push@v5
name: Build & push Web UI with REST API
with:
image: netxms_webuirest
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
dockerfile: webuirest/Dockerfile

Server:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
name: Checkout repository

- uses: mr-smithers-excellent/docker-build-push@v5
name: Build & push Server
with:
image: netxms_webuirest
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
dockerfile: server/Dockerfile

NXAgent:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
name: Checkout repository

- uses: mr-smithers-excellent/docker-build-push@v5
name: Build & push NXAgent
with:
image: netxms_webuirest
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
dockerfile: nxagent/Dockerfile
32 changes: 32 additions & 0 deletions .gitlab/scripts/collect_container_images/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import os
import gitlab
import json

return_object = dict()

try:
gitlab = gitlab.Gitlab('http://gitlab.com', job_token=os.environ['CI_JOB_TOKEN'])
except KeyError:
gitlab = gitlab.Gitlab('http://gitlab.com', private_token=os.environ['PRIVATE_TOKEN'])

project = gitlab.projects.get(int(os.environ['PROJECT_ID']))

image_registry = project.repositories.list()
for registry in image_registry:
return_object.update({
registry.path : {
"tags" : list()
},
})
for tag in registry.tags.list():
sliced_version = tag.name.split("-")
try:
for index, slice in enumerate(sliced_version):
sliced_version[index] = int(slice)
except Exception:
break
tag.name = tag.name.replace("-", ".")
return_object[registry.path]["tags"].append(tag.name)

with open('container_registry_tags.json', 'w') as output:
json.dump(return_object, output)
7 changes: 7 additions & 0 deletions .gitlab/scripts/collect_container_images/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
certifi==2020.12.5
chardet==4.0.0
idna==2.10
python-gitlab==2.7.1
requests==2.25.1
requests-toolbelt==0.9.1
urllib3==1.26.4
29 changes: 29 additions & 0 deletions .gitlab/scripts/parse_releases_from_changelog/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import re as regex # To split the original file based on specific astrisks
import json # To output the result as JSON

changeLogFile = open("/mnt/c/Users/MBeckett/Documents/Repositories/netxms-dockerfiles/changelog/ChangeLog", "r").read()
flatChangeList = list()

# Regex breakdown:
# | divides two seperate regex statements
# ^ finds start of string, $ finds end of string, characters between these are matched
# \ escapes the * as * is a special character in regex and we want to match '*' or '* '
for change in regex.split(r'^\*$|^\* $', changeLogFile, flags=regex.MULTILINE):
if change != '\n': # Strip blank lines
if change != '': # Strip blank lines
flatChangeList.append(change) # Create flat list containing version numbers and patch notes

changeList = list(zip(flatChangeList[0::2], flatChangeList[1::2])) # Split the list into a list of tuples containing (Version, Patch Notes)

OutDict = dict() # Create to dict to be output as JSON
for change in changeList:
# Strip extra new lines and asterisk in change version/change text
changeVersion = change[0].lstrip("\n* ").rstrip("\n")
ChangeText = change[1].lstrip("\n").rstrip("\n")
if "CURRENT" in changeVersion:
continue
OutDict[changeVersion] = ChangeText # Add each version to dict

# Write file out to JSON
with open('releases_from_changelog.json', 'w') as file:
file.write(json.dumps(OutDict))
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Docker image of NetXMS Server ([www.netxms.org](http://www.netxms.org/)). Curren
Quickstart with

```
docker run registry.gitlab.com/matthew-beckett/netxms-dockerfiles/server:latest
docker run ghcr.io/matthew-beckett/netxms_server:latest
```

# Environment variables
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions nxagent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
FROM debian:buster-slim
MAINTAINER Matt Beckett <[email protected]>

ENV NETXMS_VERSION_AGENT=3.8.314-1
ENV MAJOR_VERSION=3.8 MINOR_VERSION=314
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && \
apt-get update && apt-get -y install curl apt-transport-https gnupg && \
curl -sL http://packages.netxms.org/netxms.gpg | apt-key add - && \
echo "deb http://packages.netxms.org/debian/ buster main" > /etc/apt/sources.list.d/netxms.list && \
apt-get update && apt-get -y install netxms-agent=$NETXMS_VERSION_AGENT && apt-get clean
apt-get update && apt-get -y install netxms-agent="${MAJOR_VERSION}.${MINOR_VERSION}-1" && apt-get clean

COPY ./docker-entrypoint.sh /
COPY nxagent/docker-entrypoint.sh /

RUN chmod 755 /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
5 changes: 5 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"config:base"
]
}
6 changes: 3 additions & 3 deletions server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

FROM debian:buster-slim
MAINTAINER Matt Beckett <[email protected]>
ENV NETXMS_VERSION_SERVER=3.8.314-1 NETXMS_VERSION_AGENT=3.8.314-1
ENV MAJOR_VERSION=3.8 MINOR_VERSION=314

RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && \
apt-get update && apt-get -y install curl apt-transport-https gnupg && \
curl -sL http://packages.netxms.org/netxms.gpg | apt-key add - && \
echo "deb http://packages.netxms.org/debian/ buster main" > /etc/apt/sources.list.d/netxms.list && \
apt-get update && apt-get -y install netxms-server=$NETXMS_VERSION_SERVER netxms-agent=$NETXMS_VERSION_AGENT netxms-dbdrv-sqlite3=$NETXMS_VERSION_SERVER supervisor && apt-get clean
apt-get update && apt-get -y install netxms-server="${MAJOR_VERSION}.${MINOR_VERSION}-1" netxms-agent="${MAJOR_VERSION}.${MINOR_VERSION}-1" netxms-dbdrv-sqlite3="${MAJOR_VERSION}.${MINOR_VERSION}-1" supervisor && apt-get clean

VOLUME /data

EXPOSE 4701

ENV NETXMS_UNLOCKONSTARTUP=1 NETXMS_STARTAGENT=1 NXAGENT_REGISTERSERVER=127.0.0.1

COPY ./docker-entrypoint.sh ./nxagent.sh /
COPY server/docker-entrypoint.sh server/nxagent.sh /

RUN chmod 755 /docker-entrypoint.sh /nxagent.sh

Expand Down
2 changes: 1 addition & 1 deletion webui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ MAINTAINER Matt Beckett <[email protected]>

ENV MAJOR_VERSION=3.8 MINOR_VERSION=314 NETXMS_SERVER=127.0.0.1 NETXMS_SESSIONTIMEOUT=120 NETXMS_ENABLEADVANCEDSETTINGS=true

COPY ./docker-entrypoint.sh /
COPY webui/docker-entrypoint.sh /

RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && \
apt-get update && apt-get -y install wget apt-transport-https && \
Expand Down
2 changes: 1 addition & 1 deletion webuirest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ MAINTAINER Matt Beckett <[email protected]>

ENV MAJOR_VERSION=3.8 MINOR_VERSION=314 NETXMS_SERVER=127.0.0.1 NETXMS_SESSIONTIMEOUT=120 NETXMS_ENABLEADVANCEDSETTINGS=true

COPY ./docker-entrypoint.sh /
COPY webuirest/docker-entrypoint.sh /

RUN wget -O /usr/local/tomcat/webapps/nxapisrv.war http://www.netxms.org/download/releases/${MAJOR_VERSION}/netxms-websvc-${MAJOR_VERSION}.${MINOR_VERSION}.war && \
sha256sum /usr/local/tomcat/webapps/nxapisrv.war && \
Expand Down

0 comments on commit b40fa61

Please sign in to comment.