Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DP-860 : fix container CICD #13

Merged
merged 4 commits into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
with:
fetch-depth: '0'
- name: Bump version and push tag
uses: anothrNick/github-tag-action@1.39.0
uses: anothrNick/github-tag-action@1.46.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
Expand Down
77 changes: 51 additions & 26 deletions .github/workflows/docker-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
push:
branches:
- main
- dev
tags:
- 'v*.*.*'
pull_request:
Expand All @@ -16,38 +17,62 @@ on:
release:
types: [released]
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
submodules: recursive
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_PUBLIC_TOKEN }}
with:
projectBaseDir: ./
args: >
-Dsonar.organization=mov-ai
-Dsonar.projectKey=MOV-AI_${{ github.event.repository.name }}
-Dsonar.verbose=true
-Dsonar.sources=.
-Dsonar.scm.provider=git
-Dsonar.qualitygate.wait=true
-Dsonar.qualitygate.timeout=300

docker-build:
uses: MOV-AI/.github/.github/workflows/docker-workflow.yml@main
uses: MOV-AI/.github/.github/workflows/docker-workflow.yml@v1
with:
docker_file: Dockerfile
docker_image: qa/redis2
docker_image: devops/redis2
github_ref: ${{ github.ref }}
deploy: ${{ contains(github.ref, 'refs/heads/main') || contains(github.ref, 'refs/tags/v')}}
version: ${GITHUB_REF##*/}
push_latest: ${{ contains(github.ref, 'refs/heads/main') || contains(github.ref, 'refs/tags/v') }}
public: true
public_image: ce/redis2
snyk_check: true
secrets:
registry_user: ${{ secrets.PORTUS_APP_USER }}
registry_password: ${{ secrets.PORTUS_APP_TOKEN }}
pub_registry_user: ${{ secrets.PORTUS_APP_USER }}
pub_registry_password: ${{ secrets.PORTUS_APP_TOKEN }}
snyk_token: ${{ secrets.SNYK_TOKEN }}
extra_tagging:
needs: [docker-build]
runs-on: ubuntu-latest
env:
DOCKER_PUSH: ${{ contains(github.ref, 'refs/heads/main') || contains(github.ref, 'refs/tags/v')}}
DOCKER_REGISTRY: registry.cloud.mov.ai
if: ${{ contains(github.ref, 'refs/heads/main') || contains(github.ref, 'refs/tags/v')}}
steps:
- name: Login to Movai Registry
uses: docker/login-action@v2
with:
username: ${{ secrets.PORTUS_APP_USER }}
password: ${{ secrets.PORTUS_APP_TOKEN }}
registry: ${{ env.DOCKER_REGISTRY }}
- name: "Verify push and tag vars from env"
id: get_version
env:
GITHUB_REF: ${{ github.ref }}
DOCKER_PUSH: ${{ env.DOCKER_PUSH }}
run: |
echo $GITHUB_REF
echo $DOCKER_PUSH
if [ "${DOCKER_PUSH}" = "true" ]; then
if [ "${GITHUB_REF}" = "refs/heads/main" ]; then
echo ::set-output name=DOCKER_TAG::latest
else
echo ::set-output name=DOCKER_TAG::${GITHUB_REF##*/}
fi
else
echo ::set-output name=DOCKER_TAG::local
fi
- name: Extra tags
run: |
images="redis2"
for img in $images; do
docker pull "${{ env.DOCKER_REGISTRY }}/devops/${img}:${{ steps.get_version.outputs.DOCKER_TAG }}"
docker tag "${{ env.DOCKER_REGISTRY }}/devops/${img}:${{ steps.get_version.outputs.DOCKER_TAG }}" "${{ env.DOCKER_REGISTRY }}/develop/${img}:${{ steps.get_version.outputs.DOCKER_TAG }}"
docker tag "${{ env.DOCKER_REGISTRY }}/devops/${img}:${{ steps.get_version.outputs.DOCKER_TAG }}" "${{ env.DOCKER_REGISTRY }}/qa/${img}:${{ steps.get_version.outputs.DOCKER_TAG }}"
docker push "${{ env.DOCKER_REGISTRY }}/develop/${img}:${{ steps.get_version.outputs.DOCKER_TAG }}"
docker push "${{ env.DOCKER_REGISTRY }}/qa/${img}:${{ steps.get_version.outputs.DOCKER_TAG }}"
done