Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a566998180 | |||
| 1239cc5673 | |||
| 20a6099969 |
@@ -326,3 +326,31 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
source /tmp/build-ctx/build.env
|
source /tmp/build-ctx/build.env
|
||||||
bash scripts/report-status.sh failure "Tag $NEXT_VERSION FAILED" ci-docker-tag
|
bash scripts/report-status.sh failure "Tag $NEXT_VERSION FAILED" ci-docker-tag
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [tag-commit]
|
||||||
|
if: always()
|
||||||
|
steps:
|
||||||
|
- name: Delete build artifacts
|
||||||
|
run: |
|
||||||
|
echo "Siivotaan artifactit..."
|
||||||
|
RUN_ID="${{ github.run_id }}"
|
||||||
|
REPO="${{ github.repository }}"
|
||||||
|
SERVER="${{ gitea.server_url }}"
|
||||||
|
|
||||||
|
# List artifacts for this run
|
||||||
|
ARTIFACTS=$(curl -s \
|
||||||
|
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||||
|
"${SERVER}/api/v1/repos/${REPO}/actions/runs/${RUN_ID}/artifacts")
|
||||||
|
|
||||||
|
echo "Artifacts: $(echo "$ARTIFACTS" | jq -r '.artifacts | length') kpl"
|
||||||
|
|
||||||
|
# Delete each by name
|
||||||
|
echo "$ARTIFACTS" | jq -r '.artifacts[] | .name' | while IFS= read -r name; do
|
||||||
|
echo "Deleting: $name"
|
||||||
|
curl -s -X DELETE \
|
||||||
|
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||||
|
"${SERVER}/api/v1/repos/${REPO}/actions/runs/${RUN_ID}/artifacts/${name}"
|
||||||
|
echo " -> deleted $name"
|
||||||
|
done
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
GITEA_API_URL=https://gitea.app.keskikuja.site
|
GITEA_API_URL=https://gitea.app.keskikuja.site
|
||||||
GIT_PAGES_URL=https://ci-reports.helm-dev.keskikuja.site
|
GIT_PAGES_URL=https://ci-reports.helm-dev.keskikuja.site
|
||||||
DOCKER_REGISTRY=gitea.app.keskikuja.site/niko/gitea-ci-library
|
DOCKER_REGISTRY=gitea.app.keskikuja.site/niko
|
||||||
DOCKER_IMAGE_NAME=gitea-ci-library-test-image
|
DOCKER_IMAGE_NAME=gitea-ci-library-test-image
|
||||||
DOCKER_UI_URL=https://gitea.app.keskikuja.site/niko/gitea-ci-library/-/packages/container/gitea-ci-library-test-image
|
DOCKER_UI_URL=https://gitea.app.keskikuja.site/niko/-/packages/container/gitea-ci-library-test-image
|
||||||
|
|||||||
@@ -7,18 +7,24 @@ Pipeline rakentaa Docker-kontin ja pushee sen haluttuun registryyn.
|
|||||||
## 1. Konfiguroi `gitea-env.conf`
|
## 1. Konfiguroi `gitea-env.conf`
|
||||||
|
|
||||||
```
|
```
|
||||||
|
# DOCKER_REGISTRY on muotoa: registry.example.com/org
|
||||||
|
#
|
||||||
|
# host+org: registry.example.com/org
|
||||||
|
#
|
||||||
|
# Pipeline rakentaa kuvan: ${DOCKER_REGISTRY}/${DOCKER_IMAGE_NAME}:${VERSION}
|
||||||
|
|
||||||
DOCKER_REGISTRY=gitea.app.keskikuja.site/niko # PAKOLLINEN — tyhjä ei käy
|
DOCKER_REGISTRY=gitea.app.keskikuja.site/niko # PAKOLLINEN — tyhjä ei käy
|
||||||
DOCKER_IMAGE_NAME=gitea-ci-library-test-image # PAKOLLINEN
|
DOCKER_IMAGE_NAME=gitea-ci-library-test-image # PAKOLLINEN — pelkkä kuvan nimi
|
||||||
DOCKER_UI_URL=https://gitea.app.keskikuja.site/niko/-/packages/container/gitea-ci-library-test-image # valinnainen
|
DOCKER_UI_URL= # valinnainen — tarkista Giteasta kontin oma UI-osoite ja laita se tähän ilman versiota. Workflow liittää perään /VERSION
|
||||||
```
|
```
|
||||||
|
|
||||||
| Kenttä | Pakollinen | Kuvaus |
|
| Kenttä | Pakollinen | Kuvaus |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| `DOCKER_REGISTRY` | **kyllä** | Registry + mahdollinen organisaatio. **Tyhjä arvo pysäyttää workflow'n virheeseen.** Esim. `gitea.app.keskikuja.site/niko` |
|
| `DOCKER_REGISTRY` | **kyllä** | Registry + mahdollinen organisaatio. **Tyhjä pysäyttää workflow'n.** |
|
||||||
| `DOCKER_IMAGE_NAME` | **kyllä** | Pelkkä kuvan nimi. Esim. `gitea-ci-library-test-image` |
|
| `DOCKER_IMAGE_NAME` | **kyllä** | Pelkkä kuvan nimi. |
|
||||||
| `DOCKER_UI_URL` | ei | Base-URL kontin UI-sivulle (ilman versiota). Workflow liittää perään `/VERSION`. Giteassa muotoa `.../container/<DOCKER_IMAGE_NAME>` |
|
| `DOCKER_UI_URL` | ei | Base-URL kontin UI-sivulle (ilman versiota). Osoite riippuu onko kontti linkitetty repoon vai ei — tarkista Giteasta. Workflow liittää perään `/VERSION`. |
|
||||||
|
|
||||||
**Koko image-ref:** `${DOCKER_REGISTRY}/${DOCKER_IMAGE_NAME}:${VERSION}`
|
**Koko image-ref = `${DOCKER_REGISTRY}/${DOCKER_IMAGE_NAME}:${VERSION}`**
|
||||||
Esim. `gitea.app.keskikuja.site/niko/gitea-ci-library-test-image:0.1.0`
|
Esim. `gitea.app.keskikuja.site/niko/gitea-ci-library-test-image:0.1.0`
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -71,19 +77,30 @@ Jos registry vaatii eri käyttäjätunnuksen kuin `github.actor` (esim. Artifact
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 5. Esimerkkejä eri registryille
|
## 5. Esimerkkejä eri polkurakenteista
|
||||||
|
|
||||||
### Gitea Packages
|
### 5a. Pelkkä hosti — Artifactory
|
||||||
|
|
||||||
|
```
|
||||||
|
DOCKER_REGISTRY=ngdo-docker.artifactorypro.shared.pub.tds.tieto.com
|
||||||
|
DOCKER_IMAGE_NAME=microservice-temperature-store
|
||||||
|
DOCKER_UI_URL=https://artifactorypro.shared.pub.tds.tieto.com/ui/repos/tree/General/ngdo-docker.artifactorypro.shared.pub.tds.tieto.com/microservice-temperature-store
|
||||||
|
```
|
||||||
|
|
||||||
|
- Kontti: `ngdo-docker.../microservice-temperature-store:0.1.0`
|
||||||
|
- Secret `DOCKER_USERNAME` = service account -tunnus
|
||||||
|
- Secret `DOCKER_PASSWORD` = API-token
|
||||||
|
|
||||||
|
### 5b. Hosti + org — Gitea user-taso
|
||||||
|
|
||||||
```
|
```
|
||||||
DOCKER_REGISTRY=gitea.app.keskikuja.site/niko
|
DOCKER_REGISTRY=gitea.app.keskikuja.site/niko
|
||||||
DOCKER_IMAGE_NAME=gitea-ci-library-test-image
|
DOCKER_IMAGE_NAME=gitea-ci-library-test-image
|
||||||
DOCKER_UI_URL=https://gitea.app.keskikuja.site/niko/-/packages/container/gitea-ci-library-test-image
|
DOCKER_UI_URL= # tarkista Giteasta kontin UI-osoite
|
||||||
```
|
```
|
||||||
|
|
||||||
- PAT scope: `package` Read and Write
|
- Kontti: `gitea.app.keskikuja.site/niko/gitea-ci-library-test-image:0.1.0`
|
||||||
|
- Paketti käyttäjän `niko` alla. Linkitys repoon tehdään Gitean UI:sta: paketin sivulta (Package → Settings) → linkitä repositoryyn.
|
||||||
### Docker Hub
|
|
||||||
|
|
||||||
```
|
```
|
||||||
DOCKER_REGISTRY=docker.io/library
|
DOCKER_REGISTRY=docker.io/library
|
||||||
@@ -93,14 +110,3 @@ DOCKER_UI_URL=https://hub.docker.com/r/library/oma-kuva
|
|||||||
|
|
||||||
- Secret `DOCKER_USERNAME` = Docker Hub -käyttäjä
|
- Secret `DOCKER_USERNAME` = Docker Hub -käyttäjä
|
||||||
- Secret `DOCKER_PASSWORD` = Access Token (ei salasana)
|
- Secret `DOCKER_PASSWORD` = Access Token (ei salasana)
|
||||||
|
|
||||||
### Artifactory (kuten legacy Jenkins)
|
|
||||||
|
|
||||||
```
|
|
||||||
DOCKER_REGISTRY=ngdo-docker.artifactorypro.shared.pub.tds.tieto.com
|
|
||||||
DOCKER_IMAGE_NAME=microservice-temperature-store
|
|
||||||
DOCKER_UI_URL=https://artifactorypro.shared.pub.tds.tieto.com/ui/repos/tree/General/ngdo-docker.artifactorypro.shared.pub.tds.tieto.com/microservice-temperature-store
|
|
||||||
```
|
|
||||||
|
|
||||||
- Secret `DOCKER_USERNAME` = service account -tunnus
|
|
||||||
- Secret `DOCKER_PASSWORD` = API-token
|
|
||||||
|
|||||||
Reference in New Issue
Block a user