Skip to content

Commit

Permalink
fix: fixed conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
ArshiaBP committed Dec 4, 2024
2 parents 4a25d7e + 5af5fd6 commit 447020e
Show file tree
Hide file tree
Showing 29 changed files with 286 additions and 1,421 deletions.
141 changes: 141 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Build and Deploy

on:
workflow_dispatch:
push:
branches: ["main", "dev"]

jobs:
build:
environment: main
env:
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
runs-on: ubuntu-latest
outputs:
latest_tag: ${{ steps.set_latest_tag.outputs.latest_tag }}
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install musl cc
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: musl-tools musl-dev musl
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version-file: './go.mod'
# cache: false # Disable Go modules caching
- name: Tag Version
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GH_ACCESS_TOKEN }}
release_branches: main
tag_prefix: v
# Removed Go modules cache step
- name: Configure Git for Private Repos
run: |
git config --global url.https://[email protected]/opengovern.insteadOf https://github.com/opengovern
- name: Build Google Workspace Plugin App
working-directory: ./steampipe-plugin-googleworkspace
run: make build
- name: Pack Google Workspace Plugin Build
working-directory: ./steampipe-plugin-googleworkspace
run: |
tar -cvf build.tar build
- name: Upload Google Workspace Plugin Artifact
uses: actions/upload-artifact@v3
with:
name: steampipe-plugin-googleworkspace
path: ./steampipe-plugin-googleworkspace/build.tar
retention-days: 1
- name: Build Local Describer App
working-directory: .
run: make local-build
- name: Pack Local Describer Build
working-directory: .
run: |
tar -cvf local.tar local
- name: Upload Local Artifact
uses: actions/upload-artifact@v3
with:
name: local-og-describer-googleworkspace
path: ./local.tar
retention-days: 1
- name: Set Latest Tag Output
id: set_latest_tag
run: |
if [[ -z "${{ steps.tag_version.outputs.new_tag }}" ]]; then
echo "latest_tag=${{ steps.tag_version.outputs.previous_tag }}" >> "$GITHUB_OUTPUT"
else
echo "latest_tag=${{ steps.tag_version.outputs.new_tag }}" >> "$GITHUB_OUTPUT"
fi
deploy-googleworkspace-plugin:
needs: build
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
environment: main
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Download Google Workspace Plugin Artifact
uses: actions/download-artifact@v3
with:
name: steampipe-plugin-googleworkspace
path: .
- name: Unpack Google Workspace Plugin Artifact
run: |
tar -xvf build.tar
- name: Log in to Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
- name: Build and Push Docker Image for Google Workspace Plugin
uses: docker/build-push-action@v4
with:
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/steampipe-plugin-googleworkspace:0.0.1
ghcr.io/${{ github.repository_owner }}/steampipe-plugin-googleworkspace:${{ needs.build.outputs.latest_tag }}
file: steampipe-plugin-googleworkspace/docker/Dockerfile
context: .

deploy-local-describer:
needs:
- build
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
environment: main
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Download Local Describer Artifact
uses: actions/download-artifact@v3
with:
name: local-og-describer-googleworkspace
path: .
- name: Unpack Local Describer Artifact
run: |
tar -xvf local.tar
- name: Log in to Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
- name: Build and Push Docker Image for Local Describer
uses: docker/build-push-action@v4
with:
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/og-describer-googleworkspace:local-latest
ghcr.io/${{ github.repository_owner }}/og-describer-googleworkspace:local-${{ needs.build.outputs.latest_tag }}
file: DockerFileLocal
context: .
8 changes: 8 additions & 0 deletions DockerFileLocal
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM docker.io/golang:alpine as build
RUN apk --no-cache add ca-certificates

FROM scratch
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY ./local/og-describer-googleworkspace ./
ENTRYPOINT [ "./og-describer-googleworkspace" ]
CMD [ "./og-describer-googleworkspace" ]
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.PHONY: build

local-build: clean
CC=/usr/bin/musl-gcc GOPRIVATE="github.com/opengovern" GOOS=linux GOARCH=amd64 go build -a -v -mod=mod -ldflags "-linkmode external -extldflags '-static' -s -w" -tags musl -o ./local/og-describer-googleworkspace main.go

build-cli: clean
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -v -ldflags "-w -extldflags -static" -o ./build/og-googleworkspace-cli ./command/main.go

clean:
rm -rf ./local/og-describer-googleworkspace ./build/og-googleworkspace-cli
6 changes: 5 additions & 1 deletion steampipe-plugin-googleworkspace/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
STEAMPIPE_INSTALL_DIR ?= ~/.steampipe
BUILD_TAGS = netgo

build:
GOPRIVATE="github.com/opengovern" CC=/usr/bin/musl-gcc GOOS=linux GOARCH=amd64 go build -v -mod=mod -ldflags "-linkmode external -extldflags '-static' -s -w" -o ./build/steampipe-plugin-googleworkspace.plugin *.go

install:
go build -o $(STEAMPIPE_INSTALL_DIR)/plugins/hub.steampipe.io/plugins/turbot/googleworkspace@latest/steampipe-plugin-googleworkspace.plugin -tags "${BUILD_TAGS}" *.go
go build -o $(STEAMPIPE_INSTALL_DIR)/plugins/hub.steampipe.io/plugins/turbot/googleworkspace@latest/steampipe-plugin-googleworkspace.plugin -tags "${BUILD_TAGS}" *.go
3 changes: 3 additions & 0 deletions steampipe-plugin-googleworkspace/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM alpine:latest

COPY ../build/steampipe-plugin-googleworkspace.plugin /steampipe-plugin-googleworkspace.plugin
113 changes: 0 additions & 113 deletions steampipe-plugin-googleworkspace/go.mod

This file was deleted.

Loading

0 comments on commit 447020e

Please sign in to comment.