Compare commits

...

10 commits

Author SHA1 Message Date
baalajimaestro 3278e16057
Install gitpython from alpine repos
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-06-18 20:38:00 +05:30
baalajimaestro 1d99a1e160
Simplify CI config by using ssh deploy keys
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-06-18 20:33:57 +05:30
baalajimaestro b20f4082eb
Update congo
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-06-05 09:13:45 +05:30
baalajimaestro a9b08ad89d
Adapt config for hugo v0.112.0
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-06-01 11:59:53 +05:30
baalajimaestro 2a8a1cf5ed
Bump congo version
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-06-01 11:57:00 +05:30
baalajimaestro 19e703c6f0
New logo yay!
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-05-24 23:17:53 +05:30
baalajimaestro cd79f4d7ce
Revert back to alpine based images
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-04-14 16:10:38 +05:30
baalajimaestro b47e31882c
Update build script according to changes in docker image
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-03-23 22:31:11 +05:30
baalajimaestro 584aeb3785
Tidy up the go.sum/go.mod
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-03-23 18:39:58 +05:30
baalajimaestro 76abf688c6
Uprev congo
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-03-23 18:39:30 +05:30
13 changed files with 38 additions and 20 deletions

View file

@ -1,8 +1,18 @@
#! /bin/sh
apk add --no-cache python3 py3-pip git
apk add git python3 py3-gitpython openssh-client
mkdir ~/.ssh
chmod 700 ~/.ssh
echo "Setting Host Keys for GitLab...."
echo '[git.baalajimaestro.me]:29999 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC3IrYRuprw3liGd+/EGLBFqxQ9S2+/1FNxNCpO87wjRIpDxZjAWOvT2tUoIEUzWEGNHqkgRLn+rR0hsGK0SqHIPyEIsJ5AKuS7zuhy6fkVS7RsDHjJ8usBF4j3EnkYBse5qLgUIf37u0mF0EXAFcuwOBgvXM6hqL0UYcQqRGWWrHvkRRcmizkAcxJcframf3+PLG/vn4fSUH7ZUUqjx6/QIJS0iFb0HB2mv8sWzpJlJmy46WZVltwPDLOLeGZb4OcAB20/yfPalb4MsQeSrVmYtRos3sN8Uh/DwfNT/u5Jk6qqXHm3GW2fzsbZInb+0XjrmdaH3awhUN0vQMDvYgvR2UcZHgRuJvKXMAo3keOA8m9cBXJvopr/TyKt4GUvIGzjXUB9kyW/sIxn6qJel8y3b486FxV1EI2m9wKzFbtRdRG1xWxjTR16LyerrzwgAaAayFxyuQ6UgvM4zCzdgk6cDT2hGfHhF2NUKiWDobGowQJairVCzaYZCT/jy9avm2M=' >> ~/.ssh/known_hosts
echo '[git.baalajimaestro.me]:29999 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBL0yV054Ox/OPWCAz6hzo6VKkugDJx7ziCQBAdjhWfTTK3YCYroPANtflimBZYNhl43OyUx0mbdh8W27+T/PXBU=' >> ~/.ssh/known_hosts
echo '[git.baalajimaestro.me]:29999 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHJWhNlVfjAqfnHGqtqudlRZ8IBD8gt2XJUvBBAI6+5K' >> ~/.ssh/known_hosts
git config --global user.name baalajimaestro
git config --global user.email me@baalajimaestro.me
pip3 install GitPython
export HUGO_ENV=production
python3 .buildpush.py

View file

@ -6,11 +6,7 @@ from time import time
from pathlib import Path
# All the env vars
base_repo_user = os.environ.get("BASE_REPO_USERNAME")
base_repo_token = os.environ.get("BASE_REPO_TOKEN")
content_repo_git = os.environ.get("CONTENT_REPO_GIT")
content_repo_username = os.environ.get("CONTENT_REPO_USERNAME")
content_repo_token = os.environ.get("CONTENT_REPO_TOKEN")
out_dir = os.environ.get("OUT_DIR")
# Find absolute path of current directory
@ -19,11 +15,15 @@ path = Path(cwd)
base_dir = str(path)
current_time = str(int(time()))
# Set SSH Key path
git_ssh_cmd = "ssh -i /tmp/ssh-key"
# Clone our content
content_repo = Repo.clone_from(
f"https://{content_repo_username}:{content_repo_token}@git.baalajimaestro.me/baalajimaestro/{content_repo_git}.git",
f"ssh://git@git.baalajimaestro.me:29999/baalajimaestro/{content_repo_git}.git",
f"{base_dir}/content",
branch="prod"
branch="prod",
env=dict(GIT_SSH_COMMAND=git_ssh_cmd)
)
@ -33,7 +33,7 @@ os.chdir(out_dir)
repo = Repo.init(out_dir)
repo.create_remote(
"origin",
f"https://{base_repo_user}:{base_repo_token}@git.baalajimaestro.me/baalajimaestro/personal-website.git",
f"ssh://git@git.baalajimaestro.me:29999/baalajimaestro/personal-website.git",
)
# Build the binaries
@ -44,4 +44,4 @@ process = subprocess.run(["hugo", "--gc", "--minify", "-d", out_dir])
os.chdir(out_dir)
repo.git.add(".")
repo.index.commit(f"[MaestroCI]: Binaries as of {current_time}")
repo.git.push("origin", "master", force=True)
repo.git.push("origin", "master", force=True, env=dict(GIT_SSH_COMMAND=git_ssh_cmd))

View file

@ -1,5 +1,7 @@
build-and-push:
stage: build
before_script:
- chmod 600 $SSH_SECRET_KEY
script:
- docker run -v $(pwd):/app -w /app -e BASE_REPO_TOKEN="$BASE_REPO_TOKEN" -e BASE_REPO_USERNAME="$BASE_REPO_USERNAME" -e CONTENT_REPO_GIT="$CONTENT_REPO_GIT" -e CONTENT_REPO_TOKEN="$CONTENT_REPO_TOKEN" -e CONTENT_REPO_USERNAME="$CONTENT_REPO_USERNAME" -e OUT_DIR="$OUT_DIR" registry.baalajimaestro.me/baalajimaestro/hugo-alpine-ext:latest sh .build.sh
- docker run -v $(pwd):/app -w /app -v "$SSH_SECRET_KEY":/tmp/ssh-key -e CONTENT_REPO_GIT="$CONTENT_REPO_GIT" -e OUT_DIR="$OUT_DIR" registry.baalajimaestro.me/baalajimaestro/hugo-alpine-ext:latest sh .build.sh
- docker run -v $(pwd):/app busybox rm -rf /app/content /app/resources

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 62 KiB

View file

@ -1,9 +1,7 @@
languageCode = "en"
languageName = "English"
displayName = "EN"
isoCode = "en"
weight = 1
rtl = false
copyright = "&copy; 2023 Maestro Creativescape."
title = "baalajimaestro"
@ -11,4 +9,10 @@ title = "baalajimaestro"
[author]
name = "baalajimaestro"
image = "logo.webp"
headline = "DevOps Engineer, and Self-taught System Administrator"
headline = "DevOps Engineer, and Self-taught System Administrator"
[params]
isoCode = "en"
displayName = "EN"
rtl = false
dateFormat = "2 January 2006"

2
go.mod
View file

@ -2,4 +2,4 @@ module github.com/baalajimaestro/personal-website
go 1.17
require github.com/jpanther/congo/v2 v2.5.2 // indirect
require github.com/jpanther/congo/v2 v2.6.1 // indirect

10
go.sum
View file

@ -1,4 +1,6 @@
github.com/jpanther/congo/v2 v2.5.0 h1:eAnZFSsY9C0buQmyRVtIR7WAl2sHZEn5LXYvwS7BsxI=
github.com/jpanther/congo/v2 v2.5.0/go.mod h1:1S7DRoO1ZYS4YUdFd1LjTkdyjQwsjFWd8TqSfz3Jd+M=
github.com/jpanther/congo/v2 v2.5.2 h1:cSM6cnBfbsSN9uYIKXjnyudZDWK+OWWVPVlFmkQQSGE=
github.com/jpanther/congo/v2 v2.5.2/go.mod h1:1S7DRoO1ZYS4YUdFd1LjTkdyjQwsjFWd8TqSfz3Jd+M=
github.com/jpanther/congo/v2 v2.5.4 h1:6SLJ5y1hXs2eu4Ce8HBT5YLLbnu0GE+CZ686p/2jRFw=
github.com/jpanther/congo/v2 v2.5.4/go.mod h1:1S7DRoO1ZYS4YUdFd1LjTkdyjQwsjFWd8TqSfz3Jd+M=
github.com/jpanther/congo/v2 v2.6.0 h1:0AS0YKxEdqiAxzE4dUm9aSzVTOGIZW5GzD5syOWmsKw=
github.com/jpanther/congo/v2 v2.6.0/go.mod h1:1S7DRoO1ZYS4YUdFd1LjTkdyjQwsjFWd8TqSfz3Jd+M=
github.com/jpanther/congo/v2 v2.6.1 h1:iA8uosVsiMl3JbBSBwMvrxEibzBcDp+RIj18f/cmlDs=
github.com/jpanther/congo/v2 v2.6.1/go.mod h1:1S7DRoO1ZYS4YUdFd1LjTkdyjQwsjFWd8TqSfz3Jd+M=

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 365 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 612 B

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 12 KiB