Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c12e372c89 | |||
|
|
025f7adbc7 | ||
|
|
5d02c55d59 | ||
|
|
210dc7c82d | ||
|
|
00f83e794d | ||
|
|
a1f54ad69d | ||
|
|
be77ca4010 | ||
|
|
c7e6a9c40a | ||
|
|
b279615662 |
48
.github/workflows/argocd.yaml
vendored
48
.github/workflows/argocd.yaml
vendored
@@ -7,7 +7,14 @@ on:
|
|||||||
ARGOCD_GIT_TOKEN:
|
ARGOCD_GIT_TOKEN:
|
||||||
required: true
|
required: true
|
||||||
description: 'Token for ArgoCD Git access'
|
description: 'Token for ArgoCD Git access'
|
||||||
|
ARGOCD_GIT_SSH_KEY:
|
||||||
|
required: false
|
||||||
|
description: 'SSH key for ArgoCD Git access'
|
||||||
inputs:
|
inputs:
|
||||||
|
ssh_known_hosts:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: "gitea.pinpod.ir ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDayM+ZPLQzaIS/m4xiM0w6aH8nbQYLvv7EMkVLC7gb83AJrr1nEX8z5ayt1Ed6GDMdniwdhyx9jZXagTDFwSb/p19pJ1dIThyI1Zap1aDzG6fxTOCMWqTOyEbvGTCcOuzmWloblqM8KMjrRfBP2dnRsmOCHYTOtjlDPOHvtruqbgyQjD3+1y1ico8U82+sE6N448/f6ytCPZMiAGNpk5DJomfCc34zuSSFeTpRiPZjJ2dNHUzebVG+V8jjqeDef1LlxAhZ7fgvhfzs1b7eI6pdh0zNCgmsFOuc38re4lrwyVK3BqJrp0w6ioA78FQ3bHVqPnN5U5FqH4eK2BzSOxfznw3+jki2/0gNcR+QuPEej5U4BIvJwfJ7C7XPaYvMFf1/s1wgIxFtpl1djIcWcU3H3nQ62qn30k5oMDWySYFm5ONB+tDVCsDtxHa5uMagaDa3SzeU+pdHrdPFdpXd4AH61SuZv3xbuij0TA9u5C30IKzBktbAxPtNDlry9HekrasNQAvYb5B4eVrLIPnSCIwwJrWMreX5q0ZhPin465q8bJN/IPvkHhRH4K3EWO4nIN+hpv56dETeUOF3xqeUZhdp/i0Q0WQMt5+5ruZjKiz31mAerXD74GUPVwn/euKKhwTX3W9E9FhH106+r7pSHObewIM5ZdtgpEmBecE5uFzi5Q=="
|
||||||
registry:
|
registry:
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
@@ -42,13 +49,27 @@ jobs:
|
|||||||
id: slug
|
id: slug
|
||||||
|
|
||||||
- name: checkout argocd repo
|
- name: checkout argocd repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v7
|
||||||
with:
|
with:
|
||||||
|
ref: main
|
||||||
repository: ${{ inputs.argocd_repo_url }}
|
repository: ${{ inputs.argocd_repo_url }}
|
||||||
token: ${{ secrets.ARGOCD_GIT_TOKEN }}
|
token: ${{ secrets.ARGOCD_GIT_TOKEN }}
|
||||||
- uses: imranismail/setup-kustomize@v2
|
# ssh-key: ${{ secrets.ARGOCD_GIT_SSH_KEY }}
|
||||||
with:
|
# ssh-known-hosts: ${{ inputs.ssh_known_hosts }}
|
||||||
kustomize-version: '5.7.1'
|
# path: argocd-repo
|
||||||
|
|
||||||
|
# - uses: imranismail/setup-kustomize@v2
|
||||||
|
# with:
|
||||||
|
# kustomize-version: '5.7.1'
|
||||||
|
# TODO: caching kustomize binary
|
||||||
|
|
||||||
|
- name: install kustomize
|
||||||
|
run: |
|
||||||
|
set -e -x # enable debugging
|
||||||
|
curl -sSL -o kustomize.tar.gz https://gitea.pinpod.ir/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv5.8.1/kustomize_v5.8.1_linux_amd64.tar.gz
|
||||||
|
tar -xzf kustomize.tar.gz
|
||||||
|
mv kustomize /usr/local/bin/kustomize
|
||||||
|
chmod +x /usr/local/bin/kustomize
|
||||||
|
|
||||||
- name: debug info
|
- name: debug info
|
||||||
if: ${{ inputs.debug }}
|
if: ${{ inputs.debug }}
|
||||||
@@ -61,13 +82,13 @@ jobs:
|
|||||||
set -x # enable debugging
|
set -x # enable debugging
|
||||||
printenv
|
printenv
|
||||||
# check if org exists
|
# check if org exists
|
||||||
if [ -d "./manifests/${{env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL}}/${{env.GITHUB_REF_SLUG}}" ]; then
|
if [ -d "./manifests/${{env.GITHUB_REF_SLUG}}/${{env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL}}" ]; then
|
||||||
echo "Org directory exists"
|
echo "Org directory exists"
|
||||||
else
|
else
|
||||||
echo "Org directory does not exist, creating..."
|
echo "Org directory does not exist, creating..."
|
||||||
mkdir -p "./manifests/${{env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL}}/${{env.GITHUB_REF_SLUG}}"
|
mkdir -p "./manifests/${{env.GITHUB_REF_SLUG}}/${{env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL}}"
|
||||||
fi
|
fi
|
||||||
cd "./manifests/${{env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL}}/${{env.GITHUB_REF_SLUG}}"
|
cd "./manifests/${{env.GITHUB_REF_SLUG}}/${{env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL}}"
|
||||||
# check if README.md exists
|
# check if README.md exists
|
||||||
if [ -f "README.md" ]; then
|
if [ -f "README.md" ]; then
|
||||||
echo "README.md file exists"
|
echo "README.md file exists"
|
||||||
@@ -86,7 +107,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
- name: list files
|
- name: list files
|
||||||
if : ${{ inputs.debug }}
|
if : ${{ inputs.debug }}
|
||||||
run: ls -laR ./manifests/${{env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL}}/${{env.GITHUB_REF_SLUG}}
|
run: ls -laR ./manifests/${{env.GITHUB_REF_SLUG}}/${{env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL}}
|
||||||
|
|
||||||
- name: kustomize set image
|
- name: kustomize set image
|
||||||
run: |
|
run: |
|
||||||
@@ -96,11 +117,11 @@ jobs:
|
|||||||
printenv
|
printenv
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "./manifests/${{env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL}}/${{env.GITHUB_REF_SLUG}}"
|
cd "./manifests/${{env.GITHUB_REF_SLUG}}/${{env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL}}"
|
||||||
|
|
||||||
echo "${{ inputs.readme }}" > README.md
|
echo "${{ inputs.readme }}" > README.md
|
||||||
echo "# Deployed image info" >> README.md
|
echo "# Deployed image info" >> README.md
|
||||||
echo "Updating image to ${{ inputs.registry }}/${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG_CS }}/${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL_CS }}:sha-${{ github.sha }}" >> README.md
|
echo "Updating image to ${{ inputs.registry }}/${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}/${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL }}:sha-${{ github.sha }}" >> README.md
|
||||||
echo "" >> README.md
|
echo "" >> README.md
|
||||||
echo "Last updated at $(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> README.md
|
echo "Last updated at $(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> README.md
|
||||||
echo "" >> README.md
|
echo "" >> README.md
|
||||||
@@ -113,8 +134,7 @@ jobs:
|
|||||||
kustomize create .
|
kustomize create .
|
||||||
fi
|
fi
|
||||||
|
|
||||||
kustomize edit set image ${{ inputs.registry }}/${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG_CS }}/${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL_CS }}:latest=${{ inputs.registry }}/${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG_CS }}/${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL_CS }}:sha-${{ github.sha }}
|
kustomize edit set image ${{ inputs.registry }}/${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}/${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL }}:latest=${{ inputs.registry }}/${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}/${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL }}:sha-${{ github.sha }}
|
||||||
kustomize edit set namespace ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL_CS }}-${{ env.GITHUB_REF_SLUG }}
|
|
||||||
kustomize edit set annotation \
|
kustomize edit set annotation \
|
||||||
app.io/version:"${{ github.sha }}" \
|
app.io/version:"${{ github.sha }}" \
|
||||||
app.io/branch:"${{ github.ref_name }}" \
|
app.io/branch:"${{ github.ref_name }}" \
|
||||||
@@ -125,7 +145,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
set -x # enable debugging
|
set -x # enable debugging
|
||||||
cd "./manifests/${{env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL}}/${{env.GITHUB_REF_SLUG}}"
|
cd "./manifests/${{env.GITHUB_REF_SLUG}}/${{env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL}}"
|
||||||
cat README.md
|
cat README.md
|
||||||
cat kustomization.yaml
|
cat kustomization.yaml
|
||||||
- name: Commit and push changes
|
- name: Commit and push changes
|
||||||
@@ -135,7 +155,7 @@ jobs:
|
|||||||
set -x # enable debugging
|
set -x # enable debugging
|
||||||
printenv
|
printenv
|
||||||
fi
|
fi
|
||||||
cd "./manifests/${{env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL}}/${{env.GITHUB_REF_SLUG}}"
|
cd "./manifests/${{env.GITHUB_REF_SLUG}}/${{env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL}}"
|
||||||
git config --global user.name "github-actions[bot]"
|
git config --global user.name "github-actions[bot]"
|
||||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
git add .
|
git add .
|
||||||
|
|||||||
6
.github/workflows/docker.yaml
vendored
6
.github/workflows/docker.yaml
vendored
@@ -33,6 +33,11 @@ on:
|
|||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
type=sha
|
type=sha
|
||||||
type=sha,format=long
|
type=sha,format=long
|
||||||
|
build_args:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: ""
|
||||||
|
description: "Extra --build-arg values, one KEY=VALUE per line"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -72,3 +77,4 @@ jobs:
|
|||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
annotations: ${{ steps.meta.outputs.annotations }}
|
annotations: ${{ steps.meta.outputs.annotations }}
|
||||||
|
build-args: ${{ inputs.build_args }}
|
||||||
|
|||||||
@@ -1,2 +1,4 @@
|
|||||||
FROM nginx:latest
|
ARG NGINX_VERSION=latest
|
||||||
|
ARG NGINX_REPOSITORY=docker.registry.pv.linuz.ir
|
||||||
|
FROM ${NGINX_REPOSITORY}/nginx:${NGINX_VERSION}
|
||||||
COPY . /usr/share/nginx/html/
|
COPY . /usr/share/nginx/html/
|
||||||
Reference in New Issue
Block a user