first commit
This commit is contained in:
commit
2c9eacc21a
6
DckrFile/Dockerfile.txt
Normal file
6
DckrFile/Dockerfile.txt
Normal file
@ -0,0 +1,6 @@
|
||||
FROM inductiveautomation/ignition:latest
|
||||
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
git && \
|
||||
rm -rf /var/lib/apt/lists/*
|
7
Dockerfile
Normal file
7
Dockerfile
Normal file
@ -0,0 +1,7 @@
|
||||
FROM inductiveautomation/ignition:latest
|
||||
USER 0
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
git && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
CMD ["test 0"]
|
0
README.md
Normal file
0
README.md
Normal file
24
commit_and_push.py
Normal file
24
commit_and_push.py
Normal file
@ -0,0 +1,24 @@
|
||||
def handleMessage(payload):
|
||||
import time
|
||||
|
||||
script_path = '/usr/local/bin/ignition/data/factorystack/scripts/ignition-save.sh'
|
||||
|
||||
project = payload['project']
|
||||
|
||||
logger = system.util.getLogger("FactoryStack")
|
||||
logger.info("'Commit and Push' request received from project '{}'.".format(project))
|
||||
|
||||
try:
|
||||
actor = payload['actor']
|
||||
resources = payload['resources']
|
||||
|
||||
added = ['/'.join([project, resource['path']]) for resource in resources['added']]
|
||||
modified = ['/'.join([project, resource['path']]) for resource in resources['modified']]
|
||||
removed = ['/'.join([project, resource['path']]) for resource in resources['removed']]
|
||||
|
||||
time.sleep(5) # following best practices guide from Inductive Automation
|
||||
system.util.execute([script_path] + [actor] + added + modified + removed)
|
||||
|
||||
logger.info("'Commit and Push' operation completed.")
|
||||
except:
|
||||
logger.error("Error occurred during 'Commit and Push' operation. Please contact 4IR Support.")
|
37
docker-Compose.yml
Normal file
37
docker-Compose.yml
Normal file
@ -0,0 +1,37 @@
|
||||
services:
|
||||
# Ignition Gateway
|
||||
gateway1:
|
||||
image: ignitiongit
|
||||
ports:
|
||||
- 9088:8088
|
||||
volumes:
|
||||
- gw1-data:/usr/local/bin/ignition/data
|
||||
command: >
|
||||
-n dev-env
|
||||
-m 1024
|
||||
--
|
||||
wrapper.java.initmemory=512
|
||||
-Dignition.allowunsignedmodules=true
|
||||
gateway2:
|
||||
image: ignitiongit
|
||||
ports:
|
||||
- 9089:8088
|
||||
volumes:
|
||||
- gw2-data:/usr/local/bin/ignition/data
|
||||
command: >
|
||||
-n prod-env
|
||||
-m 1024
|
||||
--
|
||||
wrapper.java.initmemory=512
|
||||
-Dignition.allowunsignedmodules=true
|
||||
|
||||
volumes:
|
||||
gw1-data:
|
||||
gw2-data:
|
||||
|
||||
version: "3"
|
||||
|
||||
networks:
|
||||
gitea:
|
||||
external: false
|
||||
|
10
ignition-save.sh
Normal file
10
ignition-save.sh
Normal file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
cd /usr/local/bin/ignition/data/projects || exit
|
||||
|
||||
NOW=$(date +"%m-%d-%Y %H:%M:%S")
|
||||
actor="${1}"
|
||||
git add "${@:2}"
|
||||
git commit -m "Designer save by $actor @ $NOW"
|
||||
git push origin
|
27
ignition-startup.sh
Normal file
27
ignition-startup.sh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# For the workshop, expect the password to match the username
|
||||
GIT_PASSWORD=${GIT_USER}
|
||||
|
||||
# Consume parameters from Environment Variables
|
||||
if [[ -z "${BRANCH}" ]]; then
|
||||
REMOTE_BRANCH="origin/main"
|
||||
else
|
||||
REMOTE_BRANCH="origin/${BRANCH}"
|
||||
fi
|
||||
|
||||
# Set global git parameters
|
||||
git config --global user.name "$GIT_USER"
|
||||
git config --global user.email "$GIT_EMAIL"
|
||||
git config --global init.defaultBranch 'main'
|
||||
|
||||
cd /usr/local/bin/ignition/data/projects || exit
|
||||
|
||||
if [ ! -d '.git' ]; then
|
||||
git init
|
||||
git remote add origin "https://$GIT_USER:$GIT_PASSWORD@$GIT_HOSTNAME:$GIT_PORT/$GIT_ORG/$GIT_REPO.git"
|
||||
git fetch
|
||||
#git reset origin/main # Required when the versioned files existed in path before "git init" of this repo.
|
||||
git checkout -t "${REMOTE_BRANCH}"
|
||||
fi
|
1
startup.py
Normal file
1
startup.py
Normal file
@ -0,0 +1 @@
|
||||
system.util.execute(["/usr/local/bin/ignition/data/factorystack/scripts/ignition-startup.sh"])
|
8
update.py
Normal file
8
update.py
Normal file
@ -0,0 +1,8 @@
|
||||
# Copy the code below into projects that should be version controlled
|
||||
system.util.sendMessage('FactoryStack', 'Commit and Push',
|
||||
payload = {
|
||||
'project': system.project.getProjectName(),
|
||||
'actor': actor,
|
||||
'resources': resources
|
||||
}
|
||||
)
|
6
uploadToGIT.sh
Normal file
6
uploadToGIT.sh
Normal file
@ -0,0 +1,6 @@
|
||||
git init
|
||||
git checkout -b main
|
||||
git add README.md
|
||||
git commit -m "first commit"
|
||||
git remote add origin https://gittea.dev/Aravindan/Scripts.git
|
||||
git push -u origin main
|
Loading…
x
Reference in New Issue
Block a user