diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..2bba1987 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,16 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/go/.devcontainer/base.Dockerfile + +# [Choice] Go version (use -bullseye variants on local arm64/Apple Silicon): 1, 1.16, 1.17, 1-bullseye, 1.16-bullseye, 1.17-bullseye, 1-buster, 1.16-buster, 1.17-buster +FROM mcr.microsoft.com/devcontainers/go:1-1.21-bullseye + +ENV DOCKER_BUILDKIT=1 +ENV DOCKER_DEFAULT_PLATFORM=linux/amd64 + +# [Optional] Uncomment this section to install additional OS packages. +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends git curl graphviz + +USER vscode + +# Install github act +RUN curl -s https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..bd31383d --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,56 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/go +{ + "name": "Go", + "build": { + "dockerfile": "Dockerfile", + "args": { + } + }, + "containerEnv": { + "GITHUB_ACTOR": "${localEnv:GITHUB_ACTOR}", + "GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}" + }, + // "runArgs": ["--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"], + "runArgs": [ + //"--cap-add=SYS_PTRACE", + //"--security-opt", + //"seccomp=unconfined", + "--network=host", + //"--network=cheetah-infrastructure" + "--privileged" + ], + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + // Set *default* container specific settings.json values on container create. + "settings": { + "go.toolsManagement.checkForUpdates": "local", + "go.useLanguageServer": true, + "go.gopath": "/go" + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "golang.Go", + "ms-azuretools.vscode-docker", + "redhat.vscode-yaml", + "IronGeek.vscode-env", + "github.vscode-github-actions", + "jebbs.plantuml", + "GitHub.copilot", + "github.vscode-github-actions" + ] + } + }, + "features": { + "ghcr.io/devcontainers/features/docker-in-docker:2": {} + }, + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 1854 + ], + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "go version", + // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode" +} \ No newline at end of file diff --git a/.github/workflows/rc-release.yaml b/.github/workflows/rc-release.yaml new file mode 100644 index 00000000..0a7f8c6d --- /dev/null +++ b/.github/workflows/rc-release.yaml @@ -0,0 +1,71 @@ +name: "Publish Manual Release" +on: + workflow_dispatch: + push: + branches: + - cheetah-main + +env: + IMAGE_NAME: ${{ github.repository }} + +permissions: + contents: read + packages: write + +jobs: + release: + runs-on: ubuntu-latest + name: Release release-candiate + steps: + - name: Checkout + uses: actions/checkout@v2.3.4 + + - name: Setup go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.work' + cache: false + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@879dcbb708d40f8b8679d4f7941b938a086e23a7 + with: + images: ghcr.io/${{ env.IMAGE_NAME }} + labels: | + org.opencontainers.image.vendor=Trifork + org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=ref,event=branch,suffix=-${{ github.run_id }} + type=ref,event=pr + type=ref,event=tag + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + + - name: build + working-directory: opensearch-operator/ + run: make build + + - name: Docker login + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5 + with: + file: opensearch-operator/Dockerfile + context: opensearch-operator/ + push: true + outputs: type=registry + builder: ${{ steps.buildx.outputs.name }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max