-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: iamabhishek-dubey <abhishekbhardwaj510@gmail.com>
- Loading branch information
1 parent
ae99f5b
commit 832fe86
Showing
7 changed files
with
266 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
--- | ||
trigger: | ||
- master | ||
|
||
pr: | ||
branches: | ||
include: | ||
- master | ||
|
||
variables: | ||
- group: RuntimeVariables | ||
|
||
stages: | ||
- stage: precheck | ||
jobs: | ||
- job: govet | ||
dependsOn: [] | ||
pool: | ||
vmImage: "ubuntu-18.04" | ||
steps: | ||
- task: GoTool@0 | ||
displayName: "Installing Golang" | ||
inputs: | ||
version: '1.16' | ||
- task: Go@0 | ||
displayName: "Executing go vet" | ||
inputs: | ||
command: 'custom' | ||
customCommand: 'vet' | ||
|
||
- stage: code_quality | ||
dependsOn: ["precheck"] | ||
jobs: | ||
- job: golang_ci_lint | ||
dependsOn: [] | ||
pool: | ||
vmImage: "ubuntu-18.04" | ||
steps: | ||
- task: GoTool@0 | ||
displayName: "Installing Golang" | ||
inputs: | ||
version: '1.16' | ||
- script: | | ||
curl -sSfL https://github.com/raw/golangci/golangci-lint/master/install.sh | sh -s v1.40.0 | ||
./bin/golangci-lint run --timeout 5m0s ./... | ||
displayName: "Executing golang-ci lint" | ||
- stage: dockerfile_lint | ||
dependsOn: ["precheck"] | ||
jobs: | ||
- job: dockerfile_lint | ||
dependsOn: [] | ||
pool: | ||
vmImage: "ubuntu-18.04" | ||
steps: | ||
- script: scripts/dockerfile-linter.sh | ||
displayName: "Executing dockerlinter" | ||
|
||
- stage: build | ||
dependsOn: ["code_quality"] | ||
jobs: | ||
- job: linux_amd64 | ||
dependsOn: [] | ||
pool: | ||
vmImage: "ubuntu-18.04" | ||
steps: | ||
- task: GoTool@0 | ||
displayName: "Installing Golang" | ||
inputs: | ||
version: '1.16' | ||
- task: Go@0 | ||
displayName: "Executing go build" | ||
inputs: | ||
command: 'build' | ||
arguments: '-o $(Agent.BuildDirectory)/k8s-vault-webhook' | ||
- task: ArchiveFiles@2 | ||
displayName: 'Archiving go binary' | ||
inputs: | ||
rootFolderOrFile: '$(Agent.BuildDirectory)/k8s-vault-webhook' | ||
includeRootFolder: true | ||
archiveType: 'zip' | ||
archiveFile: '$(Build.ArtifactStagingDirectory)/compiled/k8s-vault-webhook-linux-amd64.zip' | ||
replaceExistingArchive: true | ||
- task: PublishBuildArtifacts@1 | ||
inputs: | ||
PathtoPublish: '$(Build.ArtifactStagingDirectory)/compiled' | ||
ArtifactName: 'drop' | ||
publishLocation: 'Container' | ||
|
||
- stage: build_image | ||
dependsOn: ["dockerfile_lint"] | ||
jobs: | ||
- job: linux_amd64 | ||
dependsOn: [] | ||
steps: | ||
- task: Docker@2 | ||
displayName: "Building docker image" | ||
inputs: | ||
command: 'build' | ||
Dockerfile: '**/Dockerfile' | ||
tags: '$(Build.BuildId)' | ||
|
||
- stage: release_binaries | ||
dependsOn: ["build", "build_image"] | ||
jobs: | ||
- job: goreleaser | ||
dependsOn: [] | ||
pool: | ||
vmImage: "ubuntu-18.04" | ||
steps: | ||
- script: scripts/goreleaser.sh | ||
displayName: "Releasing go binaries" | ||
env: | ||
GITHUB_TOKEN: $(GithubToken) | ||
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) | ||
|
||
- stage: release_quay | ||
dependsOn: ["build", "build_image"] | ||
jobs: | ||
- job: quay | ||
dependsOn: [] | ||
pool: | ||
vmImage: "ubuntu-18.04" | ||
steps: | ||
- task: Docker@2 | ||
displayName: "Publish quay image" | ||
inputs: | ||
containerRegistry: 'QuayServiceConnection' | ||
repository: 'opstree/k8s-vault-webhook' | ||
command: 'buildAndPush' | ||
Dockerfile: '**/Dockerfile' | ||
tags: | | ||
latest | ||
$(Build.SourceBranchName) | ||
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) | ||
|
||
- stage: release_github_image | ||
dependsOn: ["build", "build_image"] | ||
jobs: | ||
- job: github | ||
dependsOn: [] | ||
pool: | ||
vmImage: "ubuntu-18.04" | ||
steps: | ||
- task: Docker@2 | ||
displayName: "Publish github image" | ||
inputs: | ||
containerRegistry: 'GithubServiceConnection' | ||
repository: 'ot-container-kit/k8s-vault-webhook/k8s-vault-webhook' | ||
command: 'buildAndPush' | ||
Dockerfile: '**/Dockerfile' | ||
tags: | | ||
latest | ||
$(Build.SourceBranchName) | ||
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) | ||
|
||
- stage: verify | ||
dependsOn: ["release_binaries", "release_quay", "release_github_image"] | ||
jobs: | ||
- job: verfiy | ||
dependsOn: [] | ||
pool: | ||
vmImage: "ubuntu-18.04" | ||
steps: | ||
- task: DownloadBuildArtifacts@0 | ||
displayName: "Downloading the artifact" | ||
inputs: | ||
buildType: 'current' | ||
downloadType: 'single' | ||
artifactName: 'drop' | ||
downloadPath: '$(System.ArtifactsDirectory)' | ||
- task: ExtractFiles@1 | ||
displayName: "Extracting files" | ||
inputs: | ||
archiveFilePatterns: '$(System.ArtifactsDirectory)/drop/k8s-vault-webhook-linux-amd64.zip' | ||
destinationFolder: '$(Agent.BuildDirectory)' | ||
cleanDestinationFolder: false | ||
overwriteExistingFiles: true | ||
- script: | | ||
$(Agent.BuildDirectory)/k8s-vault-webhook --help | ||
displayName: "Executing k8s-vault-webhook" | ||
- stage: docs | ||
dependsOn: ["release_binaries", "release_quay", "release_github_image"] | ||
jobs: | ||
- job: verfiy | ||
dependsOn: [] | ||
pool: | ||
vmImage: "ubuntu-18.04" | ||
steps: | ||
- task: NodeTool@0 | ||
displayName: "Installing NodeJS" | ||
inputs: | ||
versionSpec: '6.x' | ||
- script: scripts/build-docs.sh | ||
displayName: "Building documentation" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
build_docs() { | ||
cd docs; yarn install | ||
cd docs; yarn build | ||
} | ||
|
||
build_docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
download_hadolint() { | ||
wget https://github.com/hadolint/hadolint/releases/download/v2.4.0/hadolint-Linux-x86_64 | ||
chmod +x hadolint-Linux-x86_64 | ||
} | ||
|
||
execute_hadolint() { | ||
./hadolint-Linux-x86_64 Dockerfile --ignore DL3007 --ignore DL3018 | ||
} | ||
|
||
main() { | ||
download_hadolint | ||
execute_hadolint | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
install_goreleaser() { | ||
curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh | ||
} | ||
|
||
release() { | ||
install_goreleaser | ||
./bin/goreleaser release --rm-dist | ||
} | ||
|
||
compare_version() { | ||
version=$(cat VERSION) | ||
if ! git tag -l | grep "${version}" | ||
then | ||
echo "git tag ${version}" | ||
git tag "${version}" | ||
release | ||
else | ||
git tag -l | ||
echo "Latest version is already updated" | ||
fi | ||
} | ||
|
||
compare_version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
install_spellcheck() { | ||
sudo apt-get update -y | ||
sudo apt-get install -y aspell | ||
} | ||
|
||
run_spellcheck() { | ||
aspell ../README.md | ||
aspell ../CHANGELOG.md | ||
aspell ../DEVELOPMENT.md | ||
} | ||
|
||
main() { | ||
install_spellcheck | ||
run_spellcheck | ||
} | ||
|
||
main |