mirror of
https://github.com/house-of-vanity/k8s-secrets.git
synced 2026-02-04 09:47:58 +00:00
Added query params to get values in plain text
This commit is contained in:
103
.github/workflows/build-and-publish.yml
vendored
103
.github/workflows/build-and-publish.yml
vendored
@@ -86,72 +86,36 @@ jobs:
|
|||||||
name: ${{ env.BINARY_NAME }}_${{ matrix.platform_name }}
|
name: ${{ env.BINARY_NAME }}_${{ matrix.platform_name }}
|
||||||
path: target/${{ matrix.build_target }}/release/${{ env.BINARY_NAME }}
|
path: target/${{ matrix.build_target }}/release/${{ env.BINARY_NAME }}
|
||||||
|
|
||||||
prepare_docker_matrix:
|
build_docker:
|
||||||
name: Prepare Docker Matrix
|
name: Build and Publish Multi-arch Docker Image
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
|
||||||
platforms: ${{ steps.set-matrix.outputs.platforms }}
|
|
||||||
platform-list: ${{ steps.set-matrix.outputs.platform-list }}
|
|
||||||
steps:
|
|
||||||
- name: Set matrix based on available artifacts
|
|
||||||
id: set-matrix
|
|
||||||
run: |
|
|
||||||
# Get list of built platforms from build job matrix
|
|
||||||
BUILT_PLATFORMS=""
|
|
||||||
if [[ "${{ contains(needs.build.result, 'success') }}" == "true" ]]; then
|
|
||||||
# Check which platforms were actually built
|
|
||||||
# Include both amd64 and arm64
|
|
||||||
BUILT_PLATFORMS="linux/amd64,linux/arm64"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n "$BUILT_PLATFORMS" ]]; then
|
|
||||||
echo "platforms=${BUILT_PLATFORMS}" >> $GITHUB_OUTPUT
|
|
||||||
echo "platform-list=[\"linux/amd64\",\"linux/arm64\"]" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "No platforms built successfully"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
build_docker:
|
|
||||||
name: Build and Publish Docker Image
|
|
||||||
needs: [build, prepare_docker_matrix]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
platform: ${{ fromJson(needs.prepare_docker_matrix.outputs.platform-list) }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set platform variables
|
- name: Download all artifacts
|
||||||
id: platform
|
|
||||||
run: |
|
|
||||||
platform=${{ matrix.platform }}
|
|
||||||
if [[ "$platform" == "linux/arm64" ]]; then
|
|
||||||
echo "arch=arm64" >> $GITHUB_OUTPUT
|
|
||||||
echo "arch_name=arm64" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "arch=amd64" >> $GITHUB_OUTPUT
|
|
||||||
echo "arch_name=amd64" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Download artifact for platform
|
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ env.BINARY_NAME }}_linux-${{ steps.platform.outputs.arch }}
|
path: artifacts/
|
||||||
path: bin/linux_${{ steps.platform.outputs.arch }}/
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Prepare binary
|
- name: Prepare binaries
|
||||||
run: |
|
run: |
|
||||||
if [[ -f "bin/linux_${{ steps.platform.outputs.arch }}/${{ env.BINARY_NAME }}" ]]; then
|
mkdir -p bin/linux_amd64 bin/linux_arm64
|
||||||
chmod +x bin/linux_${{ steps.platform.outputs.arch }}/${{ env.BINARY_NAME }}
|
|
||||||
ls -la bin/*/
|
# Move and make binaries executable
|
||||||
else
|
if [[ -f "artifacts/${BINARY_NAME}_linux-amd64/${BINARY_NAME}" ]]; then
|
||||||
echo "Binary not found for ${{ matrix.platform }}"
|
mv artifacts/${BINARY_NAME}_linux-amd64/${BINARY_NAME} bin/linux_amd64/
|
||||||
exit 1
|
chmod +x bin/linux_amd64/${BINARY_NAME}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -f "artifacts/${BINARY_NAME}_linux-arm64/${BINARY_NAME}" ]]; then
|
||||||
|
mv artifacts/${BINARY_NAME}_linux-arm64/${BINARY_NAME} bin/linux_arm64/
|
||||||
|
chmod +x bin/linux_arm64/${BINARY_NAME}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# List files to verify
|
||||||
|
ls -la bin/*/
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
@@ -165,8 +129,8 @@ jobs:
|
|||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Set outputs
|
- name: Extract metadata
|
||||||
id: vars
|
id: meta
|
||||||
run: |
|
run: |
|
||||||
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
@@ -191,23 +155,20 @@ jobs:
|
|||||||
echo "push=false" >> $GITHUB_OUTPUT
|
echo "push=false" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Check outputs
|
- name: Check metadata
|
||||||
run: |
|
run: |
|
||||||
echo "Platform: ${{ matrix.platform }}"
|
echo "Short SHA: ${{ steps.meta.outputs.sha_short }}"
|
||||||
echo "Architecture: ${{ steps.platform.outputs.arch }}"
|
echo "Cargo Version: ${{ steps.meta.outputs.cargo_version }}"
|
||||||
echo "Short SHA: ${{ steps.vars.outputs.sha_short }}"
|
echo "Docker Tags: ${{ steps.meta.outputs.docker_tags }}"
|
||||||
echo "Docker Tags: ${{ steps.vars.outputs.docker_tags }}"
|
echo "Push: ${{ steps.meta.outputs.push }}"
|
||||||
echo "Push: ${{ steps.vars.outputs.push }}"
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push multi-arch Docker image
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile.prebuilt
|
file: ./Dockerfile.prebuilt
|
||||||
platforms: ${{ matrix.platform }}
|
platforms: linux/amd64,linux/arm64
|
||||||
push: ${{ steps.vars.outputs.push == 'true' }}
|
push: ${{ steps.meta.outputs.push == 'true' }}
|
||||||
tags: ${{ steps.vars.outputs.docker_tags }}
|
tags: ${{ steps.meta.outputs.docker_tags }}
|
||||||
build-args: |
|
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/k8s-secrets:buildcache
|
||||||
TARGETARCH=${{ steps.platform.outputs.arch }}
|
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/k8s-secrets:buildcache,mode=max
|
||||||
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/k8s-secrets:buildcache-${{ steps.platform.outputs.arch }}
|
|
||||||
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/k8s-secrets:buildcache-${{ steps.platform.outputs.arch }},mode=max
|
|
||||||
Reference in New Issue
Block a user