Compare commits

...

10 Commits

Author SHA1 Message Date
samsep101
5e386d7df8 bun init
Some checks failed
Build with Kaniko and Deploy / build-and-deploy (push) Has been cancelled
2026-01-05 16:55:22 +05:00
samsep101
5ac08324f2 bun init 2026-01-05 16:42:52 +05:00
samsep101
30a3bcc955 bun init 2026-01-05 16:35:15 +05:00
samsep101
8b7b90f0c2 bun init 2026-01-05 16:29:58 +05:00
samsep101
dc0124a3cf bun init 2026-01-05 16:02:53 +05:00
samsep101
bf6ab2aca3 bun init 2026-01-05 15:47:56 +05:00
samsep101
dbe1dfa9d6 bun init 2026-01-05 15:47:39 +05:00
samsep101
5bc7ef3745 bun init 2026-01-05 15:36:46 +05:00
samsep101
06b9a3a3ec bun init 2026-01-05 15:36:03 +05:00
samsep101
8a34e2c463 bun init 2026-01-05 15:33:56 +05:00
6 changed files with 32 additions and 75 deletions

View File

@@ -4,38 +4,55 @@ on: [push]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Получаем полную историю для корректного хеша
- name: Build and push with Kaniko (FIXED TAGS)
- name: Get commit SHA (full)
id: vars
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "sha_full=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Build and push with Kaniko
uses: aevea/action-kaniko@master
with:
registry: harbor.apps.kopikopi.com.ru
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_PASSWORD }}
image: drone/test
tags: main,latest,${{ gitea.sha }} # Добавляем main и latest
tag: ${{ steps.vars.outputs.sha_short }} # Только короткий хеш
context: .
dockerfile: Dockerfile
cache: true
cache-repo: harbor.apps.kopikopi.com.ru/proxy/cache
extra-args: |
--label "org.label-schema.vcs-ref=${{ steps.vars.outputs.sha_full }}"
--label "org.label-schema.build-date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
- name: Update team-infra repository
- name: Update infrastructure repository
run: |
# Клонируем ПРАВИЛЬНЫЙ репозиторий team-infra
# Клонируем инфра-репозиторий
git clone https://${{ secrets.USER }}:${{ secrets.GITEA }}@gitea.apps.kopikopi.com.ru/examples/nginx-intrasture.git
cd nginx-intrasture
cd nginx-intrasture/apps/static-site
# Обновляем тег образа на main
sed -i "s|image:.*drone/test:.*|image: harbor.apps.kopikopi.com.ru/drone/test:main|g" apps/static-site/deployment.yaml
# Простое решение: используем sed для изменения deployment.yaml
NEW_IMAGE="harbor.apps.kopikopi.com.ru/drone/test:${{ steps.vars.outputs.sha_short }}"
# Коммитим и пушим
# Обновляем deployment.yaml
sed -i "s|image:.*drone/test:.*|image: $NEW_IMAGE|g" deployment.yaml
# Проверяем изменение
echo "Updated deployment.yaml:"
grep image deployment.yaml
# Коммитим изменения
git config user.name "CI/CD Bot"
git config user.email "ci-cd@kopikopi.com.ru"
git add .
git commit -m "Update static-site image to main"
git push
env:
GITEA_USER: ${{ secrets.USER }}
GITEA_TOKEN: ${{ secrets.GITEA }}
git add deployment.yaml
git commit -m "Update image to ${{ steps.vars.outputs.sha_short }}"
git push

View File

@@ -1,24 +0,0 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx-test
annotations:
cert-manager.io/cluster-issuer: "letsencrypt-prod"
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: nginx
tls:
- hosts:
- nginx-test.apps.kopikopi.com.ru
secretName: nginx-test-tls
rules:
- host: nginx-test.apps.kopikopi.com.ru
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: nginx-test
port:
number: 80

View File

@@ -1,6 +0,0 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- nginx-deployment.yaml
- service.yaml
- ingress.yaml

View File

@@ -1,19 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-test
spec:
replicas: 1
selector:
matchLabels:
app: nginx-test
template:
metadata:
labels:
app: nginx-test
spec:
containers:
- name: nginx
image: nginx:alpine
ports:
- containerPort: 80

View File

@@ -2,7 +2,6 @@
<html>
<head><title>World</title></head>
<body>
<h1>🚀 Hello from GitOps!</h1>
<p>Deployed via Argo CD. Commit SHA: {{ .Commit }}</p>
<h1>hello world 2</h1>
</body>
</html>

View File

@@ -1,10 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: nginx-test
spec:
selector:
app: nginx-test
ports:
- port: 80
targetPort: 80