Skip to content

Updating neptune version and kustomize files #1775

Updating neptune version and kustomize files

Updating neptune version and kustomize files #1775

Workflow file for this run

name: CICD
on:
push:
branches:
- main
- 'release-*'
pull_request:
branches: '*'
workflow_dispatch:
branches: '*'
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21
- name: Check out code
uses: actions/checkout@v2
- name: Install depdendencies
run: |
go install github.com/golangci/golangci-lint/cmd/[email protected]
- name: Run Linters
run: |
export PATH=$PATH:$(go env GOPATH)/bin
make lint
unit:
name: Unit Test
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21
- name: Check out code
uses: actions/checkout@v2
- name: Install depdendencies
run: |
go install github.com/t-yuki/gocover-cobertura@latest
# ToDo: run tests in /cmd directory
- name: Run tests
run: |
export PATH=$PATH:$(go env GOPATH)/bin
make test
gocover-cobertura < cover.out > cobertura-coverage.xml
# ToDo: generate/merge coverage for tests in /cmd directory
- name: Generate coverage report
uses: irongut/[email protected]
with:
filename: cobertura-coverage.xml
badge: true
fail_below_min: true
format: markdown
hide_complexity: true
indicators: false
output: both
thresholds: '50 85'
- name: Add coverage PR comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md
- name: Upload coverage as artifacts
uses: actions/upload-artifact@v2
if: always()
with:
name: code-coverage
path: |
cover.out
cobertura-coverage.xml
code-coverage-results.md
retention-days: 5
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: 1.21
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Get the version (non-release branch)
if: ${{ !startsWith(github.ref, 'refs/heads/release-') }}
run: |
export BRANCH_NAME=$(echo ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}})
export BUILD_VERSION=$(date +'%Y%m%d%H%M')-$BRANCH_NAME
echo $BUILD_VERSION > VERSION
echo $BRANCH_NAME > BRANCH
- name: Get the version (release branch)
if: ${{ startsWith(github.ref, 'refs/heads/release-') }}
run: |
export BASE_VERSION=$(cat version.txt)
export VERSION=$BASE_VERSION-$(date +'%Y%m%d%H%M')
echo $VERSION > VERSION
- name: Build Images
run: |
export VERSION=$(cat VERSION)
echo $VERSION
make docker-build
- name: Push to DockerHub
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
run: |
export VERSION=$(cat VERSION)
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
make docker-push
- name: Build Install YAMLs
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') }}
run: |
export VERSION=$(cat VERSION)
make release
- name: Build default-image manifest file
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') }}
run: |
export VERSION=$(cat VERSION)
export MANIFEST_FILENAME=default-images-$VERSION.manifest
export MANIFEST_FILEPATH=./$MANIFEST_FILENAME
echo "MANIFEST_FILEPATH=$MANIFEST_FILEPATH" >> $GITHUB_ENV
echo "MANIFEST_FILENAME=$MANIFEST_FILENAME" >> $GITHUB_ENV
if [[ "${{ github.ref }}" == 'refs/heads/main' ]]; then
go run scripts/create_default_images_manifest.go $MANIFEST_FILEPATH $VERSION false
else
# Currently setting the release bool to false so we don't break downstream pipelines
go run scripts/create_default_images_manifest.go $MANIFEST_FILEPATH $VERSION false
fi
cat $MANIFEST_FILEPATH
- name: Get Version
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') }}
id: vars
run:
echo ::set-output name=version::$(cat VERSION)
- name: Create Release
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') }}
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_VERSION: "${{ steps.vars.outputs.version }}"
with:
tag_name: ${{ env.TAG_VERSION }}
release_name: Release ${{ env.TAG_VERSION }}
draft: false
prerelease: false
- name: Upload astraconnector yaml
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') }}
id: upload-astraconnector-yaml
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILE_PATH: "./build/astra_v1_astraconnector.yaml"
ASSET_NAME: "astra_v1_astraconnector.yaml"
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.FILE_PATH }}
asset_name: ${{ env.ASSET_NAME }}
asset_content_type: text/yaml
- name: Upload default-image manifest
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') }}
id: upload-manifest
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILE_PATH: ${{ env.MANIFEST_FILEPATH }}
ASSET_NAME: ${{ env.MANIFEST_FILENAME }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.FILE_PATH }}
asset_name: ${{ env.ASSET_NAME }}
asset_content_type: text/plain
- name: Upload astraconnector_operator.yaml
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') }}
id: upload-astraconnector-operator-yaml
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILE_PATH: "./build/astraconnector_operator.yaml"
ASSET_NAME: "astraconnector_operator.yaml"
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.FILE_PATH }}
asset_name: ${{ env.ASSET_NAME }}
asset_content_type: text/yaml
- name: Set astra-unified-installer.sh default versions
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') }}
run: |
export VERSION=$(cat VERSION)
cp ./unified-installer/astra-unified-installer.sh ./build/astra-unified-installer.sh
sed -i "s/readonly __DEFAULT_CONNECTOR_OPERATOR_IMAGE_TAG=\"\"/readonly __DEFAULT_CONNECTOR_OPERATOR_IMAGE_TAG=\"$VERSION\"/g" ./build/astra-unified-installer.sh
sed -i "s/readonly __GIT_REF_CONNECTOR_OPERATOR=\"main\"/readonly __GIT_REF_CONNECTOR_OPERATOR=\"$VERSION\"/g" ./build/astra-unified-installer.sh
- name: Upload astra-unified-installer.sh
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') }}
id: upload-install-script
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILE_PATH: "./build/astra-unified-installer.sh"
ASSET_NAME: "astra-unified-installer.sh"
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.FILE_PATH }}
asset_name: ${{ env.ASSET_NAME }}
asset_content_type: application/x-sh
- name: Upload example env file
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') }}
id: upload-example-install-env
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILE_PATH: "./unified-installer/install-example-config.env"
ASSET_NAME: "install-example-config.env"
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.FILE_PATH }}
asset_name: ${{ env.ASSET_NAME }}
asset_content_type: text/plain