Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

DRAFT: Show Diff #6

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
273a892
current tracing work
rhoofard Apr 10, 2024
4fc0260
fix: updated runner span/env
rhoofard Apr 10, 2024
5a72a3d
feat: swapped out terraform for opentofu on runner
rhoofard Apr 11, 2024
aa814f5
feat: updated runner release workflow for liatrio
rhoofard Apr 11, 2024
887439d
fix: updated go-sum, changed source label
rhoofard Apr 11, 2024
7216773
feat: setting up regular release
rhoofard Apr 11, 2024
1205095
fix: updating go mod/sum
rhoofard Apr 11, 2024
333e147
fix: removing toolchain, updating label
rhoofard Apr 11, 2024
112d950
fix: getting rid of unused docker builds
rhoofard Apr 11, 2024
fbe508e
fix: correcting runner tofu version
rhoofard Apr 11, 2024
1b7065c
getting rid of tftcl release
rhoofard Apr 11, 2024
64826e1
fix: keeping everything but brew
rhoofard Apr 11, 2024
c2d2a9a
removing some tfctl release types
rhoofard Apr 11, 2024
4fc4070
fix: updating repo dispatch curl request
rhoofard Apr 11, 2024
fae2564
fix: correcting repo dispatch to target tracing branch
rhoofard Apr 11, 2024
389f63d
fix: correcting runner tofu version
rhoofard Apr 11, 2024
9c2c016
feat: updating helm release to point to liatrio
rhoofard Apr 11, 2024
7bc39b9
fix: edited kustomization name replacement
rhoofard Apr 11, 2024
faab510
fix: adding arm back
rhoofard Apr 11, 2024
9502944
fix: removed state locking
rhoofard Apr 22, 2024
df3e8d8
fix: added error propagation so trace queries work
rhoofard Apr 30, 2024
b9e9ec4
feat: added team label env
rhoofard May 8, 2024
e93db1e
feat: updated tofu version
rhoofard May 9, 2024
e8fa5e6
feat: marking spans with applied attr, new tofu version
rhoofard May 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/helm-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
VERSION=$(yq e '.version' charts/tofu-controller/Chart.yaml)
mkdir helm-release
helm package charts/tofu-controller/ -d helm-release
helm push helm-release/tofu-controller-${VERSION}.tgz oci://ghcr.io/flux-iac/charts
helm push helm-release/tofu-controller-${VERSION}.tgz oci://ghcr.io/liatrio/charts
14 changes: 7 additions & 7 deletions .github/workflows/release-runners.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ jobs:
file: ./runner-base.Dockerfile
build-args: |
LIBCRYPTO_VERSION=${{ env.LIBCRYPTO_VERSION }}
platforms: linux/amd64,linux/arm64 #,linux/arm/v7
platforms: linux/amd64 #,linux/arm64 #,linux/arm/v7
tags: |
ghcr.io/flux-iac/tf-runner:${{ env.VERSION }}-base
ghcr.io/liatrio/tf-runner:${{ env.VERSION }}-base
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
Expand All @@ -75,7 +75,7 @@ jobs:
packages: write # needed for ghcr access
strategy:
matrix:
tf_version: [1.0.11, 1.1.9, 1.2.9, 1.3.9, 1.4.6, 1.5.5]
tofu_version: [0.1.3]
steps:
- name: Check out
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
Expand All @@ -102,13 +102,13 @@ jobs:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./runner.Dockerfile
platforms: linux/amd64,linux/arm64 #,linux/arm/v7
platforms: linux/amd64 #,linux/arm64 #,linux/arm/v7
build-args: |
BASE_IMAGE=ghcr.io/flux-iac/tf-runner:${{ env.VERSION }}-base
TF_VERSION=${{ matrix.tf_version }}
BASE_IMAGE=ghcr.io/liatrio/tf-runner:${{ env.VERSION }}-base
TOFU_VERSION=${{ matrix.tofu_version }}
LIBCRYPTO_VERSION=${{ env.LIBCRYPTO_VERSION }}
tags: |
ghcr.io/flux-iac/tf-runner:${{ env.VERSION }}-tf-${{ matrix.tf_version }}
ghcr.io/liatrio/tf-runner:${{ env.VERSION }}-tf-${{ matrix.tofu_version }}
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
Expand Down
116 changes: 37 additions & 79 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ jobs:
LIBCRYPTO_VERSION=${{ env.LIBCRYPTO_VERSION }}
platforms: linux/amd64,linux/arm64 #,linux/arm/v7
tags: |
ghcr.io/flux-iac/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
ghcr.io/flux-iac/${{ env.CONTROLLER }}:latest
ghcr.io/liatrio/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
ghcr.io/liatrio/${{ env.CONTROLLER }}:latest
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
Expand All @@ -93,7 +93,7 @@ jobs:
LIBCRYPTO_VERSION=${{ env.LIBCRYPTO_VERSION }}
platforms: linux/amd64,linux/arm64 #,linux/arm/v7
tags: |
ghcr.io/flux-iac/tf-runner:${{ steps.prep.outputs.VERSION }}-base
ghcr.io/liatrio/tf-runner:${{ steps.prep.outputs.VERSION }}-base
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
Expand All @@ -111,90 +111,43 @@ jobs:
file: ./runner.Dockerfile
platforms: linux/amd64,linux/arm64 #,linux/arm/v7
build-args: |
BASE_IMAGE=ghcr.io/flux-iac/tf-runner:${{ steps.prep.outputs.VERSION }}-base
BASE_IMAGE=ghcr.io/liatrio/tf-runner:${{ steps.prep.outputs.VERSION }}-base
tags: |
ghcr.io/flux-iac/tf-runner:${{ steps.prep.outputs.VERSION }}
ghcr.io/flux-iac/tf-runner:latest
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }}
org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }}
- name: Publish multi-arch tf-runner-azure container image
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
push: true
no-cache: true
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./runner-azure.Dockerfile
platforms: linux/amd64,linux/arm64 #,linux/arm/v7 - azure-cli does not install correctly on 32 bit arm
build-args: |
BASE_IMAGE=ghcr.io/flux-iac/tf-runner:${{ steps.prep.outputs.VERSION }}-base
tags: |
ghcr.io/flux-iac/tf-runner-azure:${{ steps.prep.outputs.VERSION }}
ghcr.io/flux-iac/tf-runner-azure:latest
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }}
org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }}
- name: Publish multi-arch branch-planner container image
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
push: true
no-cache: true
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./planner.Dockerfile
build-args: |
LIBCRYPTO_VERSION=${{ env.LIBCRYPTO_VERSION }}
platforms: linux/amd64,linux/arm64 #,linux/arm/v7 - azure-cli does not install correctly on 32 bit arm
tags: |
ghcr.io/flux-iac/branch-planner:${{ steps.prep.outputs.VERSION }}
ghcr.io/flux-iac/branch-planner:latest
ghcr.io/liatrio/tf-runner:${{ steps.prep.outputs.VERSION }}
ghcr.io/liatrio/tf-runner:latest
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }}
org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }}

- name: Check images
run: |
docker buildx imagetools inspect ghcr.io/flux-iac/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
docker pull ghcr.io/flux-iac/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}

docker buildx imagetools inspect ghcr.io/flux-iac/tf-runner:${{ steps.prep.outputs.VERSION }}
docker pull ghcr.io/flux-iac/tf-runner:${{ steps.prep.outputs.VERSION }}
docker buildx imagetools inspect ghcr.io/liatrio/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
docker pull ghcr.io/liatrio/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}

docker buildx imagetools inspect ghcr.io/flux-iac/tf-runner-azure:${{ steps.prep.outputs.VERSION }}
docker pull ghcr.io/flux-iac/tf-runner-azure:${{ steps.prep.outputs.VERSION }}

docker buildx imagetools inspect ghcr.io/flux-iac/branch-planner:${{ steps.prep.outputs.VERSION }}
docker pull ghcr.io/flux-iac/branch-planner:${{ steps.prep.outputs.VERSION }}
docker buildx imagetools inspect ghcr.io/liatrio/tf-runner:${{ steps.prep.outputs.VERSION }}
docker pull ghcr.io/liatrio/tf-runner:${{ steps.prep.outputs.VERSION }}
- name: Sign images
env:
COSIGN_EXPERIMENTAL: 1
run: |
cosign sign --yes ghcr.io/flux-iac/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
cosign sign --yes ghcr.io/flux-iac/tf-runner:${{ steps.prep.outputs.VERSION }}-base
cosign sign --yes ghcr.io/flux-iac/tf-runner:${{ steps.prep.outputs.VERSION }}
cosign sign --yes ghcr.io/flux-iac/tf-runner-azure:${{ steps.prep.outputs.VERSION }}
cosign sign --yes ghcr.io/flux-iac/branch-planner:${{ steps.prep.outputs.VERSION }}
cosign sign --yes ghcr.io/liatrio/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
cosign sign --yes ghcr.io/liatrio/tf-runner:${{ steps.prep.outputs.VERSION }}-base
cosign sign --yes ghcr.io/liatrio/tf-runner:${{ steps.prep.outputs.VERSION }}
# cosign sign --yes ghcr.io/liatrio/tf-runner-azure:${{ steps.prep.outputs.VERSION }}
# cosign sign --yes ghcr.io/liatrio/branch-planner:${{ steps.prep.outputs.VERSION }}
- name: Generate release manifests
if: startsWith(github.ref, 'refs/tags/v')
run: |
mkdir -p config/release
kustomize build ./config/crd > ./config/release/${{ env.CONTROLLER }}.crds.yaml
kustomize build ./config/rbac > ./config/release/${{ env.CONTROLLER }}.rbac.yaml
kustomize build ./config/manager | yq e '.spec.template.spec.containers[0].env[1].value="ghcr.io/flux-iac/tf-runner:${{ steps.prep.outputs.VERSION }}"' - > ./config/release/${{ env.CONTROLLER }}.deployment.yaml
kustomize build ./config/manager | yq e '.spec.template.spec.containers[0].env[1].value="ghcr.io/liatrio/tf-runner:${{ steps.prep.outputs.VERSION }}"' - > ./config/release/${{ env.CONTROLLER }}.deployment.yaml
kustomize build ./config/package > ./config/release/${{ env.CONTROLLER }}.packages.yaml
echo '[CHANGELOG](https://github.com/flux-iac/${{ env.CONTROLLER }}/blob/main/CHANGELOG.md)' > ./config/release/notes.md
echo '[CHANGELOG](https://github.com/liatrio/${{ env.CONTROLLER }}/blob/main/CHANGELOG.md)' > ./config/release/notes.md
- name: Setup Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
Expand All @@ -207,24 +160,29 @@ jobs:
args: release --release-notes=./config/release/notes.md --skip-validate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.TF_CONTROLLER_WEAVEWORKSBOT }}
# HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.TF_CONTROLLER_WEAVEWORKSBOT }}
- name: Publish Helm chart
uses: stefanprodan/helm-gh-pages@0ad2bb377311d61ac04ad9eb6f252fb68e207260 # v1.7.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Trigger the release-runners workflow
run: |
curl -XPOST -u "${{ secrets.GITHUB_TOKEN }}:" \
-H "Accept: application/vnd.github.everest-preview+json" \
"https://api.github.com/repos/${{ github.repository }}/dispatches" \
-d '{
"event_type": "release-runners",
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/dispatches \
-d '{
"event_type":"release-runners",
"branch" : "tracing",
"client_payload": {
"controller": "${{ env.CONTROLLER }}",
"version": "${{ steps.prep.outputs.VERSION }}",
"build_date": "${{ steps.prep.outputs.BUILD_DATE }}",
"sha": "${{ github.sha }}",
"repo_desc": "${{ github.event.repository.description }}",
"repo_url": "${{ github.event.repository.html_url }}"
}
}'
"controller": "${{ env.CONTROLLER }}",
"version": "${{ steps.prep.outputs.VERSION }}",
"build_date": "${{ steps.prep.outputs.BUILD_DATE }}",
"sha": "${{ github.sha }}",
"repo_desc": "${{ github.event.repository.description }}",
"repo_url": "${{ github.event.repository.html_url }}"
}
}'

34 changes: 15 additions & 19 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,9 @@ builds:
- -X main.BuildSHA={{.ShortCommit}} -X main.BuildVersion={{.Tag}}
goos:
- darwin
- linux
goarch:
- amd64
- arm64
- arm
goarm:
- 6
- 7

archives:
Expand Down Expand Up @@ -65,18 +61,18 @@ signs:
artifacts: checksum
output: true

brews:
- name: tfctl
ids:
- tfctl
tap:
owner: flux-iac
name: homebrew-tap
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
commit_author:
name: flux-iac
email: [email protected]
folder: Formula
homepage: https://flux-iac.github.io/tofu-controller
install: |
bin.install "tfctl"
# brews:
# - name: tfctl
# ids:
# - tfctl
# tap:
# owner: flux-iac
# name: homebrew-tap
# token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
# commit_author:
# name: flux-iac
# email: [email protected]
# folder: Formula
# homepage: https://flux-iac.github.io/tofu-controller
# install: |
# bin.install "tfctl"
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \

FROM alpine:3.19

LABEL org.opencontainers.image.source="https://github.com/flux-iac/tofu-controller"
LABEL org.opencontainers.image.source="https://github.com/liatrio/tofu-controller"

ARG LIBCRYPTO_VERSION

Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.DEFAULT_GOAL := help
# Image URL to use all building/pushing image targets
MANAGER_IMG ?= ghcr.io/flux-iac/tofu-controller
RUNNER_IMG ?= ghcr.io/flux-iac/tf-runner
MANAGER_IMG ?= ghcr.io/liatrio/tofu-controller-local
RUNNER_IMG ?= ghcr.io/liatrio/tf-runner-local
RUNNER_AZURE_IMAGE ?= ghcr.io/flux-iac/tf-runner-azure
BRANCH_PLANNER_IMAGE ?= ghcr.io/flux-iac/branch-planner
TAG ?= latest
Expand Down Expand Up @@ -152,16 +152,16 @@ docker-build: ## Build docker
docker build -t ${MANAGER_IMG}:${TAG} --build-arg LIBCRYPTO_VERSION=${LIBCRYPTO_VERSION} --build-arg TARGETARCH=${TARGETARCH} ${BUILD_ARGS} .
docker build -t ${RUNNER_IMG}:${TAG}-base -f runner-base.Dockerfile --build-arg LIBCRYPTO_VERSION=${LIBCRYPTO_VERSION} --build-arg TARGETARCH=${TARGETARCH} ${BUILD_ARGS} .
docker build -t ${RUNNER_IMG}:${TAG} -f runner.Dockerfile --build-arg BASE_IMAGE=${RUNNER_IMG}:${TAG}-base --build-arg TARGETARCH=${TARGETARCH} ${BUILD_ARGS} .
docker build -t ${RUNNER_AZURE_IMAGE}:${TAG} -f runner-azure.Dockerfile --build-arg BASE_IMAGE=${RUNNER_IMG}:${TAG}-base --build-arg TARGETARCH=${TARGETARCH} ${BUILD_ARGS} .
docker build -t ${BRANCH_PLANNER_IMAGE}:${TAG} -f planner.Dockerfile --build-arg LIBCRYPTO_VERSION=${LIBCRYPTO_VERSION} --build-arg TARGETARCH=${TARGETARCH} ${BUILD_ARGS} .
# docker build -t ${RUNNER_AZURE_IMAGE}:${TAG} -f runner-azure.Dockerfile --build-arg BASE_IMAGE=${RUNNER_IMG}:${TAG}-base --build-arg TARGETARCH=${TARGETARCH} ${BUILD_ARGS} .
# docker build -t ${BRANCH_PLANNER_IMAGE}:${TAG} -f planner.Dockerfile --build-arg LIBCRYPTO_VERSION=${LIBCRYPTO_VERSION} --build-arg TARGETARCH=${TARGETARCH} ${BUILD_ARGS} .

.PHONY: docker-buildx
docker-buildx: ## Build docker
docker buildx build --load -t ${MANAGER_IMG}:${TAG} --build-arg LIBCRYPTO_VERSION=${LIBCRYPTO_VERSION} ${BUILD_ARGS} .
docker buildx build --load -t ${RUNNER_IMG}:${TAG}-base -f runner-base.Dockerfile --build-arg LIBCRYPTO_VERSION=${LIBCRYPTO_VERSION} ${BUILD_ARGS} .
docker buildx build --load -t ${RUNNER_IMG}:${TAG} -f runner.Dockerfile --build-arg BASE_IMAGE=${RUNNER_IMG}:${TAG}-base ${BUILD_ARGS} .
docker buildx build --load -t ${RUNNER_AZURE_IMAGE}:${TAG} -f runner-azure.Dockerfile --build-arg BASE_IMAGE=${RUNNER_IMG}:${TAG}-base ${BUILD_ARGS} .
docker buildx build --load -t ${BRANCH_PLANNER_IMAGE}:${TAG} -f planner.Dockerfile --build-arg LIBCRYPTO_VERSION=${LIBCRYPTO_VERSION} ${BUILD_ARGS} .
# docker buildx build --load -t ${RUNNER_AZURE_IMAGE}:${TAG} -f runner-azure.Dockerfile --build-arg BASE_IMAGE=${RUNNER_IMG}:${TAG}-base ${BUILD_ARGS} .
# docker buildx build --load -t ${BRANCH_PLANNER_IMAGE}:${TAG} -f planner.Dockerfile --build-arg LIBCRYPTO_VERSION=${LIBCRYPTO_VERSION} ${BUILD_ARGS} .

.PHONY: docker-push
docker-push: ## Push docker image with the manager.
Expand Down
12 changes: 12 additions & 0 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,18 @@ func main() {
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
}
//trying to get the runner server to use the same env vars as the controller to export traces
// _, err := runnerServer.SetEnv(context.Background(), &runner.SetEnvRequest{
// Envs: map[string]string{
// "OTEL_TRACES_EXPORTER": "otlp",
// "OTEL_EXPORTER_OTLP_PROTOCOL": "grpc",
// "OTEL_EXPORTER_OTLP_ENDPOINT": "http://0.0.0.0:4317",
// },
// })
// if err != nil {
// setupLog.Error(err, "unable to set env vars for runner server")
// os.Exit(1)
// }
go func() {
err := mtls.StartGRPCServerForTesting(runnerServer, "flux-system", "localhost:30000", mgr, rotator)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ generatorOptions:
disableNameSuffixHash: true
images:
- name: flux-iac/tofu-controller
newName: ghcr.io/flux-iac/tofu-controller
newTag: v0.16.0-rc.4
newName: ghcr.io/liatrio/tofu-controller
newTag: v0.0.3
Loading
Loading