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

feat: add workflow templates #1

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gatici
Copy link

@gatici gatici commented Dec 20, 2024

Adding each job templates can we used in any repository by providing input variables.

@gatici gatici marked this pull request as draft December 20, 2024 11:43
@gatici
Copy link
Author

gatici commented Dec 20, 2024

This is still in-progress.

Copy link

@ghislainbourgeois ghislainbourgeois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I have some comments

Comment on lines +59 to +60
else
echo "Version change not for release"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we want to exit or return right away here to bypass the rest of the code.

Suggested change
else
echo "Version change not for release"
else
echo "Version change not for release"
exit 0

version=$(cat VERSION)
version_before_full=${{ steps.version-file.outputs.version_before }}
version_before=${version_before_full::-4}
echo "version=$version"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to validate the content of VERSION before doing anything with it. Here, a bad actor could propose a PR where the VERSION file contains something like "v1.5.0 ; echo $GITHUB_TOKEN" and extract sensitive information.

While this example would probably be easy to spot, there have been some high profiles attack on open-source projects this year and I think we need to be a bit more cautious here.

This same comment would be valid everywhere we use content from the VERSION file.

with:
registry: ${{ env.REGISTRY }}
username: "omectesting"
password: "dckr_pat_Up1vh3lGEKIfGDJuEj7Qb7OfdEE"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be a secret?

This particular password should also be changed and not put as is in a secret.

DOCKER_TAG: ${{ env.VERSION }}-testing
run: |
echo "Deleting Docker image tag: ${DOCKER_TAG}"
curl -u omectesting:dckr_pat_Up1vh3lGEKIfGDJuEj7Qb7OfdEE -X "DELETE" https://hub.docker.com/v2/repositories/${DOCKER_REPOSITORY}/5gc-amf/tags/${{ env.DOCKER_TAG }}/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment regarding the password

- uses: peterjgrainger/[email protected]
with:
branch: "rel-${{ inputs.version-branch }}"
sha: '${{ github.event.pull_request.head.sha }}'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add EOL in all files. Thanks!


- name: Increment version
run: |
version=${{ input.release-version }}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version=${{ input.release-version }}
version=${{ inputs.release-version }}

Comment on lines +24 to +25
runs-on: ubuntu-latest
if: ${{ input.release-changed == 'true' }}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that you are defining this variable as boolean, do you need to indicate true as a string?

Suggested change
runs-on: ubuntu-latest
if: ${{ input.release-changed == 'true' }}
if: ${{ inputs.release-changed == 'true' }}
runs-on: ubuntu-latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants