Skip to content

Commit

Permalink
all codefresh changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ATGardner authored and roi-codefresh committed May 30, 2022
1 parent 231fc56 commit ebac94e
Show file tree
Hide file tree
Showing 53 changed files with 6,676 additions and 1,240 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ contact_links:
url: https://argo-cd.readthedocs.io/
about: Much help can be found in the docs
- name: Ask a question
url: https://github.com/argoproj/argo-cd/discussions/new
url: https://github.com/codefresh-io/argo-cd/discussions/new
about: Ask a question or start a discussion about Argo CD
- name: Chat on Slack
url: https://argoproj.github.io/community/join-slack
Expand Down
58 changes: 32 additions & 26 deletions .github/workflows/ci-build.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
name: Integration tests
on:
on:
push:
branches:
- 'master'
- 'release-*'
- '!release-1.4'
- '!release-1.5'
# - 'master'
- "release-*"
- "!release-1.4"
- "!release-1.5"
pull_request:
branches:
- 'master'
# - 'master'
- "release-*" # Codefresh change instead of `master`

env:
# Golang version to use across CI steps
GOLANG_VERSION: '1.17'
GOLANG_VERSION: "1.17"

jobs:
check-go:
Expand Down Expand Up @@ -60,8 +61,12 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Golang
uses: actions/setup-go@v1
with:
go-version: ${{ env.GOLANG_VERSION }}
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v3
with:
version: v1.38.0
args: --timeout 10m --exclude SA5011
Expand Down Expand Up @@ -237,7 +242,7 @@ jobs:
- name: Setup NodeJS
uses: actions/setup-node@v1
with:
node-version: '12.18.4'
node-version: "12.18.4"
- name: Restore node dependency cache
id: cache-dependencies
uses: actions/cache@v1
Expand Down Expand Up @@ -306,24 +311,24 @@ jobs:
SCANNER_PATH: /tmp/cache/scanner
OS: linux
run: |
# We do not use the provided action, because it does contain an old
# version of the scanner, and also takes time to build.
set -e
mkdir -p ${SCANNER_PATH}
export SONAR_USER_HOME=${SCANNER_PATH}/.sonar
if [[ ! -x "${SCANNER_PATH}/sonar-scanner-${SCANNER_VERSION}-${OS}/bin/sonar-scanner" ]]; then
curl -Ol https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SCANNER_VERSION}-${OS}.zip
unzip -qq -o sonar-scanner-cli-${SCANNER_VERSION}-${OS}.zip -d ${SCANNER_PATH}
fi
# We do not use the provided action, because it does contain an old
# version of the scanner, and also takes time to build.
set -e
mkdir -p ${SCANNER_PATH}
export SONAR_USER_HOME=${SCANNER_PATH}/.sonar
if [[ ! -x "${SCANNER_PATH}/sonar-scanner-${SCANNER_VERSION}-${OS}/bin/sonar-scanner" ]]; then
curl -Ol https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SCANNER_VERSION}-${OS}.zip
unzip -qq -o sonar-scanner-cli-${SCANNER_VERSION}-${OS}.zip -d ${SCANNER_PATH}
fi
chmod +x ${SCANNER_PATH}/sonar-scanner-${SCANNER_VERSION}-${OS}/bin/sonar-scanner
chmod +x ${SCANNER_PATH}/sonar-scanner-${SCANNER_VERSION}-${OS}/jre/bin/java
chmod +x ${SCANNER_PATH}/sonar-scanner-${SCANNER_VERSION}-${OS}/bin/sonar-scanner
chmod +x ${SCANNER_PATH}/sonar-scanner-${SCANNER_VERSION}-${OS}/jre/bin/java
# Explicitly set NODE_MODULES
export NODE_MODULES=${PWD}/ui/node_modules
export NODE_PATH=${PWD}/ui/node_modules
# Explicitly set NODE_MODULES
export NODE_MODULES=${PWD}/ui/node_modules
export NODE_PATH=${PWD}/ui/node_modules
${SCANNER_PATH}/sonar-scanner-${SCANNER_VERSION}-${OS}/bin/sonar-scanner
${SCANNER_PATH}/sonar-scanner-${SCANNER_VERSION}-${OS}/bin/sonar-scanner
if: env.sonar_secret != ''

test-e2e:
Expand All @@ -332,9 +337,10 @@ jobs:
strategy:
matrix:
k3s-version: [v1.23.3, v1.22.6, v1.21.2]
needs:
needs:
- build-go
env:
ARGOCD_E2E_SKIP_HELM: "true"
GOPATH: /home/runner/go
ARGOCD_FAKE_IN_CLUSTER: "true"
ARGOCD_SSH_DATA_PATH: "/tmp/argo-e2e/app/config/ssh"
Expand Down Expand Up @@ -426,4 +432,4 @@ jobs:
with:
name: e2e-server-k8s${{ matrix.k3s-version }}.log
path: /tmp/e2e-server.log
if: ${{ failure() }}
# if: ${{ failure() }} # Codefresh change
2 changes: 0 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ on:

jobs:
CodeQL-Build:
if: github.repository == 'argoproj/argo-cd'

# CodeQL runs on ubuntu-latest and windows-latest
runs-on: ubuntu-latest

Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/default-branch-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: PR check

on:
pull_request:
branches:
- "release-*"

jobs:
test-default-branch:
name: base branch is a default branch
runs-on: ubuntu-latest
steps:
- name: fail if base branch is not default branch
if: ${{ github.event.pull_request.base.ref != github.event.repository.default_branch }}
uses: actions/github-script@v3
with:
script: |
core.setFailed("Base branch of the PR - ${{ github.event.pull_request.base.ref }} is not a default branch. Please reopen your PR to ${{ github.event.repository.default_branch }}")
59 changes: 26 additions & 33 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@ name: Image
on:
push:
branches:
- master
pull_request:
branches:
- master
types: [ labeled, unlabeled, opened, synchronize, reopened ]
- "release-*" # Codefresh change instead of `master`

env:
GOLANG_VERSION: '1.17'
GOLANG_VERSION: "1.17"

jobs:
publish:
if: github.repository == 'argoproj/argo-cd'
runs-on: ubuntu-latest
env:
GOPATH: /home/runner/work/argo-cd/argo-cd
Expand All @@ -31,42 +26,40 @@ jobs:
working-directory: ./src/github.com/argoproj/argo-cd
id: image

# login
# build
- run: |
docker images -a --format "{{.ID}}" | xargs -I {} docker rmi {}
make image DEV_IMAGE=true DOCKER_PUSH=false IMAGE_NAMESPACE=ghcr.io/codefresh-io IMAGE_TAG=${{ steps.image.outputs.tag }}
working-directory: ./src/github.com/argoproj/argo-cd
# publish
- run: |
docker login ghcr.io --username $USERNAME --password $PASSWORD
docker login quay.io --username "${DOCKER_USERNAME}" --password "${DOCKER_TOKEN}"
if: github.event_name == 'push'
docker push ghcr.io/codefresh-io/argocd:${{ steps.image.outputs.tag }}
env:
USERNAME: ${{ secrets.USERNAME }}
USERNAME: ${{ github.repository_owner }}
PASSWORD: ${{ secrets.TOKEN }}
DOCKER_USERNAME: ${{ secrets.RELEASE_QUAY_USERNAME }}
DOCKER_TOKEN: ${{ secrets.RELEASE_QUAY_TOKEN }}
# build
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- run: |
IMAGE_PLATFORMS=linux/amd64
if [[ "${{ github.event_name }}" == "push" || "${{ contains(github.event.pull_request.labels.*.name, 'test-arm-image') }}" == "true" ]]
then
IMAGE_PLATFORMS=linux/amd64,linux/arm64
fi
echo "Building image for platforms: $IMAGE_PLATFORMS"
docker buildx build --platform $IMAGE_PLATFORMS --push="${{ github.event_name == 'push' }}" \
-t ghcr.io/argoproj/argocd:${{ steps.image.outputs.tag }} \
-t quay.io/argoproj/argocd:latest .
working-directory: ./src/github.com/argoproj/argo-cd
# Codefresh step
- name: Push docker image to quay repository
env:
QUAY_USERNAME: ${{ secrets.RELEASE_QUAY_USERNAME }}
QUAY_TOKEN: ${{ secrets.RELEASE_QUAY_TOKEN }}
IMAGE_NAMESPACE: quay.io/codefresh
run: |
set -ue
docker login quay.io --username "${QUAY_USERNAME}" --password "${QUAY_TOKEN}"
docker tag ghcr.io/codefresh-io/argocd:${{ steps.image.outputs.tag }} ${IMAGE_NAMESPACE}/argocd:latest
docker push ${IMAGE_NAMESPACE}/argocd:latest
# deploy
- run: git clone "https://[email protected]/argoproj/argoproj-deployments"
if: github.event_name == 'push'
- run: git clone "https://[email protected]/codefresh-io/argoproj-deployments"
env:
TOKEN: ${{ secrets.TOKEN }}
- run: |
docker run -u $(id -u):$(id -g) -v $(pwd):/src -w /src --rm -t ghcr.io/argoproj/argocd:${{ steps.image.outputs.tag }} kustomize edit set image quay.io/argoproj/argocd=ghcr.io/argoproj/argocd:${{ steps.image.outputs.tag }}
git config --global user.email '[email protected]'
git config --global user.name 'CI'
docker run -v $(pwd):/src -w /src --rm -t lyft/kustomizer:v3.3.0 kustomize edit set image quay.io/argoproj/argocd=ghcr.io/codefresh-io/argocd:${{ steps.image.outputs.tag }}
git config --global user.email '[email protected]'
git config --global user.name 'CI-Codefresh'
git diff --exit-code && echo 'Already deployed' || (git commit -am 'Upgrade argocd to ${{ steps.image.outputs.tag }}' && git push)
if: github.event_name == 'push'
working-directory: argoproj-deployments/argocd
Expand Down
Loading

0 comments on commit ebac94e

Please sign in to comment.