Compare commits
No commits in common. "master" and "1.0.0" have entirely different histories.
@ -1,48 +0,0 @@
|
|||||||
name: ci
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- "master"
|
|
||||||
tags:
|
|
||||||
- "*"
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- "master"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
docker:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container:
|
|
||||||
image: catthehacker/ubuntu:act-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Docker meta
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: |
|
|
||||||
git.sebclem.fr/${{ gitea.repository }}
|
|
||||||
tags: |
|
|
||||||
type=ref,event=branch
|
|
||||||
type=ref,event=pr
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
|
|
||||||
- name: Login to registry
|
|
||||||
if: github.ref_type == 'tag'
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: git.sebclem.fr
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: ${{ github.ref_type == 'tag' }}
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
@ -1,4 +1,4 @@
|
|||||||
steps:
|
pipeline:
|
||||||
build-only:
|
build-only:
|
||||||
image: woodpeckerci/plugin-docker-buildx
|
image: woodpeckerci/plugin-docker-buildx
|
||||||
settings:
|
settings:
|
||||||
|
13
Dockerfile
13
Dockerfile
@ -1,4 +1,4 @@
|
|||||||
FROM golang:1.23.2-alpine AS build-stage
|
FROM golang:1.20.5-alpine AS build-stage
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@ -10,16 +10,15 @@ COPY *.go ./
|
|||||||
RUN CGO_ENABLED=0 GOOS=linux go build -o /entrypoint
|
RUN CGO_ENABLED=0 GOOS=linux go build -o /entrypoint
|
||||||
|
|
||||||
|
|
||||||
FROM python:3.13.0-alpine AS runtime-stage
|
FROM python:3.11.4-slim AS runtime-stage
|
||||||
|
|
||||||
RUN apk --no-cache add git openssh tar
|
# RUN apt-get update && apt-get install -y git toilet \
|
||||||
|
# && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# renovate: datasource=pypi depName=ansible
|
# renovate: datasource=pypi depName=ansible
|
||||||
ENV ANSIBLE_VERSION=10.5.0
|
ENV ANSIBLE_VERSION=8.1.0
|
||||||
RUN pip3 install --no-cache-dir ansible==${ANSIBLE_VERSION} dnspython passlib netaddr requests uptime-kuma-api
|
RUN pip3 install --no-cache-dir ansible==${ANSIBLE_VERSION} dnspython passlib netaddr
|
||||||
|
|
||||||
COPY --from=build-stage /entrypoint /bin/entrypoint
|
COPY --from=build-stage /entrypoint /bin/entrypoint
|
||||||
|
|
||||||
ENV ANSIBLE_HOST_KEY_CHECKING=False
|
|
||||||
ENV PYTHONUNBUFFERED=1
|
|
||||||
ENTRYPOINT [ "/bin/entrypoint" ]
|
ENTRYPOINT [ "/bin/entrypoint" ]
|
@ -4,7 +4,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"go.uber.org/zap/zapcore"
|
"go.uber.org/zap/zapcore"
|
||||||
@ -152,11 +151,7 @@ func main() {
|
|||||||
pluginConfig := getPluginConfig(sugar)
|
pluginConfig := getPluginConfig(sugar)
|
||||||
|
|
||||||
if pluginConfig.privateKey != nil {
|
if pluginConfig.privateKey != nil {
|
||||||
sugar.Info("🔑 Adding ssh key to .ssh/id_ed25519")
|
runCommand(sugar, "mkdir", "/root/.ssh")
|
||||||
os.MkdirAll("/root/.ssh", 0700)
|
|
||||||
if !strings.HasSuffix(*pluginConfig.privateKey, "\n") {
|
|
||||||
*pluginConfig.privateKey = *pluginConfig.privateKey + "\n"
|
|
||||||
}
|
|
||||||
err := os.WriteFile("/root/.ssh/id_ed25519", []byte(*pluginConfig.privateKey), 0400)
|
err := os.WriteFile("/root/.ssh/id_ed25519", []byte(*pluginConfig.privateKey), 0400)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
sugar.Fatal(err)
|
sugar.Fatal(err)
|
||||||
@ -167,7 +162,7 @@ func main() {
|
|||||||
|
|
||||||
if pluginConfig.vaultToken != nil {
|
if pluginConfig.vaultToken != nil {
|
||||||
sugar.Info("💼 Adding vault token to 'credentials/ci_vault_token'")
|
sugar.Info("💼 Adding vault token to 'credentials/ci_vault_token'")
|
||||||
os.MkdirAll("credentials", 0755)
|
runCommand(sugar, "mkdir", "credentials")
|
||||||
err := os.WriteFile("credentials/ci_vault_token", []byte(*pluginConfig.vaultToken), 0644)
|
err := os.WriteFile("credentials/ci_vault_token", []byte(*pluginConfig.vaultToken), 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
sugar.Fatal(err)
|
sugar.Fatal(err)
|
||||||
@ -218,6 +213,7 @@ func main() {
|
|||||||
args = append(args, "--tags", *pluginConfig.tags)
|
args = append(args, "--tags", *pluginConfig.tags)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// runCommand(sugar, "export", "ANSIBLE_HOST_KEY_CHECKING=False")
|
||||||
command := append([]string{"ansible-playbook"}, args...)
|
command := append([]string{"ansible-playbook"}, args...)
|
||||||
runCommand(sugar, command...)
|
runCommand(sugar, command...)
|
||||||
}
|
}
|
||||||
|
4
go.mod
4
go.mod
@ -2,9 +2,9 @@ module woodpecker-ansible-runner
|
|||||||
|
|
||||||
go 1.20
|
go 1.20
|
||||||
|
|
||||||
require go.uber.org/zap v1.27.0
|
require go.uber.org/zap v1.24.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
go.uber.org/atomic v1.7.0 // indirect
|
go.uber.org/atomic v1.7.0 // indirect
|
||||||
go.uber.org/multierr v1.10.0 // indirect
|
go.uber.org/multierr v1.6.0 // indirect
|
||||||
)
|
)
|
||||||
|
8
go.sum
8
go.sum
@ -13,14 +13,6 @@ go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
|||||||
go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI=
|
go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI=
|
||||||
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
|
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
|
||||||
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
|
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
|
||||||
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
|
|
||||||
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
|
||||||
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
|
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
|
||||||
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
|
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
|
||||||
go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c=
|
|
||||||
go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk=
|
|
||||||
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
|
|
||||||
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
|
|
||||||
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
|
||||||
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
Loading…
Reference in New Issue
Block a user