[DO-1617] fix gitea action
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
name: Build and publish docker image
|
name: Build and publish docker image
|
||||||
|
|
||||||
on: [push]
|
on: [ push ]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CI: ON
|
CI: ON
|
||||||
@@ -8,58 +8,59 @@ env:
|
|||||||
# Allow workflow to be manually run from the Gitea UI
|
# Allow workflow to be manually run from the Gitea UI
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_and_push:
|
build_and_push:
|
||||||
runs-on: act-runner-label
|
runs-on: docker
|
||||||
name: Builds the image and publishes to docker hub
|
name: Builds the image and publishes to docker hub
|
||||||
container:
|
container:
|
||||||
image: harbor.avroid.tech/docker-hub-proxy/catthehacker/ubuntu:act-latest
|
image: harbor.avroid.tech/docker-hub-proxy/catthehacker/ubuntu:act-latest
|
||||||
steps:
|
steps:
|
||||||
- run: printenv
|
- run: printenv
|
||||||
|
|
||||||
- name: Retrieve secrets from Hashicorp Vault
|
- name: Retrieve secrets from Hashicorp Vault
|
||||||
id: retrieve-secrets
|
id: retrieve-secrets
|
||||||
uses: https://git-mirrors.avroid.tech/Mirrors-actions/vault-action.git@v3
|
uses: https://git-mirrors.avroid.tech/Mirrors-actions/vault-action.git@v3
|
||||||
with:
|
with:
|
||||||
url: https://vault.avroid.tech
|
url: https://vault.avroid.tech
|
||||||
method: approle
|
method: approle
|
||||||
roleId: ${{ secrets.HVAULT_GITEA_ACTIONS_ROLE_ID }}
|
roleId: ${{ secrets.HVAULT_GITEA_ACTIONS_ROLE_ID }}
|
||||||
secretId: ${{ secrets.HVAULT_GITEA_ACTIONS_SECRET_ID }}
|
secretId: ${{ secrets.HVAULT_GITEA_ACTIONS_SECRET_ID }}
|
||||||
# Ниже указываем {путь к секрету в HVault} {имя ключа секрета} | {имя переменной окружения куда засетим значение секрета}
|
# Ниже указываем {путь к секрету в HVault} {имя ключа секрета} | {имя переменной окружения куда засетим значение секрета}
|
||||||
# Доступ к секретам осуществляется через заранее созданный AppRole "gitea-actions-role" в HVault и подключенную
|
# Доступ к секретам осуществляется через заранее созданный AppRole "gitea-actions-role" в HVault и подключенную
|
||||||
# к ней политику "gitea-actions". В политике описывается доступ к необходимым секретам. Политику можно посмотреть
|
# к ней политику "gitea-actions". В политике описывается доступ к необходимым секретам. Политику можно посмотреть
|
||||||
# через UI Hashicorp Vault.
|
# через UI Hashicorp Vault.
|
||||||
secrets: |
|
secrets: |
|
||||||
team-devops/data/services/registry/Harbor/harbor.avroid.tech 'service.user.ci.login' | HARBOR_LOGIN ;
|
team-devops/data/services/registry/Harbor/harbor.avroid.tech 'service.user.ci.login' | HARBOR_LOGIN ;
|
||||||
team-devops/data/services/registry/Harbor/harbor.avroid.tech 'service.user.ci.token' | HARBOR_TOKEN ;
|
team-devops/data/services/registry/Harbor/harbor.avroid.tech 'service.user.ci.token' | HARBOR_TOKEN ;
|
||||||
|
|
||||||
- name: Login to Harbor Docker Registry
|
- name: Login to Harbor Docker Registry
|
||||||
uses: https://git-mirrors.avroid.tech/Mirrors-actions/login-action@v3
|
uses: https://git-mirrors.avroid.tech/Mirrors-actions/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: https://harbor.avroid.tech
|
registry: https://harbor.avroid.tech
|
||||||
username: ${{ env.HARBOR_LOGIN }}
|
username: ${{ env.HARBOR_LOGIN }}
|
||||||
password: ${{ env.HARBOR_TOKEN }}
|
password: ${{ env.HARBOR_TOKEN }}
|
||||||
|
|
||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
uses: https://git-mirrors.avroid.tech/Mirrors-actions/checkout@v4
|
uses: https://git-mirrors.avroid.tech/Mirrors-actions/checkout@v4
|
||||||
|
|
||||||
- name: "Build image"
|
- name: "Build image"
|
||||||
run: |
|
run: |
|
||||||
make build
|
make build
|
||||||
|
|
||||||
- name: "Push image"
|
- name: "Push image"
|
||||||
run: |
|
run: |
|
||||||
make push
|
make push
|
||||||
if: ${{ gitea.ref == 'refs/heads/master' }}
|
if: ${{ gitea.ref == 'refs/heads/master' }}
|
||||||
|
|
||||||
- name: "Clear image"
|
- name: "Clear image"
|
||||||
run: |
|
run: |
|
||||||
make clean
|
make clean
|
||||||
|
|
||||||
- name: Create and push tag
|
- name: Create and push tag
|
||||||
run: |
|
run: |
|
||||||
git config user.name "Jenkins"
|
git config user.name "Jenkins"
|
||||||
git config user.email "svc-jenkins@avroid.tech"
|
git config user.email "svc-jenkins@avroid.tech"
|
||||||
git tag $(make getTag)
|
git tag $(make getTag)
|
||||||
git push origin $(make getTag)
|
git push origin $(make getTag)
|
||||||
if: ${{ gitea.ref == 'refs/heads/master' }}
|
if: ${{ gitea.ref == 'refs/heads/master' }}
|
||||||
|
|||||||
Reference in New Issue
Block a user