Wip rework deployment
This commit is contained in:
parent
f391cb3d93
commit
26f9e21083
1 changed files with 21 additions and 35 deletions
|
@ -1,37 +1,24 @@
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
|
||||||
- test
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: forge.hornwitser.no
|
REGISTRY_IMAGE: ${{ vars.REGISTRY }}/${{ github.repository }}:${{ github.ref_name }}
|
||||||
REGISTRY_IMAGE: forge.hornwitser.no/hornwitser/schedule-demo
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: debian
|
|
||||||
container:
|
container:
|
||||||
image: forge.hornwitser.no/public/builder:develop
|
image: forge.hornwitser.no/public/builder:r2025.5.2
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: debug
|
name: Authenticate with registry
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
apt info podman-docker
|
echo "${{ secrets.REGISTRY_TOKEN }}" | podman login ${{ vars.REGISTRY }} --username runner --password-stdin
|
||||||
type docker
|
|
||||||
-
|
|
||||||
name: Authenticate
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: runner
|
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
-
|
-
|
||||||
name: Get commit info
|
name: Get commit info
|
||||||
id: info
|
id: info
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
tee -a ${GITHUB_OUTPUT} <<EOF
|
tee -a ${GITHUB_OUTPUT} <<EOF
|
||||||
DEPLOY_IMAGE=${{ env.REGISTRY_IMAGE }}:${{ github.ref_name }}
|
DEPLOY_IMAGE=${{ env.REGISTRY_IMAGE }}
|
||||||
DEPLOY_BRANCH=${{ github.ref_name }}
|
DEPLOY_BRANCH=${{ github.ref_name }}
|
||||||
EOF
|
EOF
|
||||||
-
|
-
|
||||||
|
@ -44,34 +31,33 @@ jobs:
|
||||||
name: Build and push
|
name: Build and push
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
podman build --tag ${{ env.REGISTRY_IMAGE }}:latest ${{ github.workspace }}
|
podman build --tag ${{ env.REGISTRY_IMAGE }} ${{ github.workspace }}
|
||||||
podman push ${{ env.REGISTRY_IMAGE }}:latest
|
podman push ${{ env.REGISTRY_IMAGE }}
|
||||||
outputs:
|
outputs:
|
||||||
DEPLOY_IMAGE: ${{ steps.info.outputs.DEPLOY_IMAGE }}
|
DEPLOY_IMAGE: ${{ steps.info.outputs.DEPLOY_IMAGE }}
|
||||||
DEPLOY_BRANCH: ${{ steps.info.outputs.DEPLOY_BRANCH }}
|
DEPLOY_BRANCH: ${{ steps.info.outputs.DEPLOY_BRANCH }}
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: debian
|
|
||||||
needs: build
|
needs: build
|
||||||
container:
|
container:
|
||||||
image: forge.hornwitser.no/public/builder:develop
|
image: forge.hornwitser.no/public/builder:r2025.5.2
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Check info
|
name: Check info
|
||||||
run: |
|
run: |
|
||||||
echo DEPLOY_IMAGE=${{ needs.build.outputs.DEPLOY_IMAGE }}
|
echo DEPLOY_IMAGE=${{ needs.build.outputs.DEPLOY_IMAGE }}
|
||||||
echo DEPLOY_BRANCH=${{ needs.build.outputs.DEPLOY_BRANCH }}
|
echo DEPLOY_BRANCH=${{ needs.build.outputs.DEPLOY_BRANCH }}
|
||||||
|
# -
|
||||||
|
# name: Checkout deploy repository
|
||||||
|
# run: |
|
||||||
|
# git config --global user.email runner@noreply.hornwitser.no
|
||||||
|
# git config --global user.name Runner
|
||||||
|
# git config --global credential.helper store
|
||||||
|
# echo "https://runner:${{ secrets.DEPLOY_TOKEN }}@$(echo "${{ github.server_url }}" | cut -b 9-)" > ~/.git-credentials
|
||||||
|
# git clone ${{ github.server_url }}/hornwitser/infra.git ${{ github.workspace }}
|
||||||
-
|
-
|
||||||
name: Configure kubectl
|
name: Restart deployment
|
||||||
|
if: github.ref_name == 'develop'
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.kube
|
curl \
|
||||||
cat > ~/.kube/config <<"EOF"
|
-H "Authorization: ${{ secrets.WEBHOOK_RESTART_TOKEN }}"
|
||||||
${{ secrets.KUBECONFIG_CONTENT }}
|
-X POST "http://fulla.hz.hornwitser.no:9000/hooks/restart?container=schedule-demo"
|
||||||
EOF
|
|
||||||
kubectl config view
|
|
||||||
kubectl config use-context flux-sandbox
|
|
||||||
-
|
|
||||||
name: Deploy
|
|
||||||
run: |
|
|
||||||
kubectl rollout restart \
|
|
||||||
-n schedule-demo \
|
|
||||||
deployment website
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue